![]() Registered Member ![]()
|
Hi,
I'm trying to do an application based on KDE architecture. I've done a lot of progress on my own, but I have an issue regarding KMainWindow that I haven't been able to find a solution. I would like my MainWindow class subclasses KMainwindow and a Qt Design UI. The problem is that, although the application compiles and works, it crashes when the quit() event is launched. However, If I subclass from QMainWindow instead, the whole application seamlessly, including the quit() event. See this the next code for more details:
As you can see, there are two sections, one where MainWindow subclasses KMainWindow that's having the mentioned problem, and the other one subclassing QMainWindow that's working perfectly. What could I do to sort out this problem? ![]() Best regards!
Last edited by Musikolo on Mon Dec 06, 2010 12:09 pm, edited 1 time in total.
|
![]() Administrator ![]()
|
Are you using KApplication instead of QApplication in your main()?
Also, do you have a backtrace for this crash?
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
![]() KDE Developer ![]()
|
In case you are doing that, do not construct in main() the main window object on the stack, but allocate it on the heap (with new), without deleting it yourself.
Pino Toscano
|
![]() Registered Member ![]()
|
Hi everyone,
@pinotree: You deserve to be the king of the kingdom. I have just replaced, as you suggested, this:
for this other thing:
Now it works seamlessly! ![]() @bcooksley: I'm using KApplication in my main. @Everyone: Thanks a million for you unconditional support! ![]() |
![]() Registered Member ![]()
|
Seconded! ![]() I'd spent hours scratching my head about this. Somehow couldn't get Google to come up with any sensible leads. Thanks much indeed. |
![]() KDE Developer ![]()
|
Note this is written in the KMainWinow API documentation:
http://api.kde.org/4.5-api/kdelibs-apid ... 3fe46149d0
Pino Toscano
|
![]() Registered Member ![]()
|
Indeed:
Must have read that a hundred times, but it just never registered. ![]() |
![]() KDE Developer ![]()
|
No problem, it happens some times ![]()
Pino Toscano
|
Registered users: Bing [Bot], Evergrowing, Google [Bot], rockscient