App closing itself when should close only QDialog window.
-
Hi.
I have a strange behavior of my application. This will be simple tray application with few windows. Now app has simple menu. When I click "Add reminder" in my menu then show up dialog window as I expected. Problem is when I click Cancel or close button, then app closing itself not only dialog window. Where is bug in my code?
I write this application on Ubuntu 16.04 with Qt Creator 3.5.1 with Qt 5.5.1 (default from repository)
Best regards.
Draqun -
Hi
It might be the auto close feature
Try setting
app.setQuitOnLastWindowClosed(false);
in main.cpp
https://forum.qt.io/topic/79266/closing-child-object-causes-parent-to-be-closed/15 -
Hi,
Take a look at the Desktop Systray Example. It shows exactly how to handle widgets in the case you are interested in.
-
https://github.com/Draqun/qt-reminder/blob/master/qt-reminder-gui/createreminderdialog.cpp - I did it well? There no will be problem with memory in situation when I ignore this event in every window?
-
Why are you calling the base class implementation and then ignore the event ?
No, there's no leak, ignoring the event makes is go further up to be handled (or not).
-
-
Did you took a look at the Desktop Systray Example ? It really implements exactly what you need.
One of the key part is in the main.cpp file:
QApplication::setQuitOnLastWindowClosed(false);