PDA

View Full Version : QDockWidget gets hidden when closing application



Boron
9th February 2010, 15:34
Hello,
I have a QMainWindow that holds a QDockWidget. On closing the app I want to save the visibility of the dock widget.

When I close the app via the shortcut Alt + F4 odr via the x-Button in the upper-right corner the visibility of dock widget always is set to false. On the next application start the dock widget is not shown because the QSettings ini-file (where the settings of the app are stored) says "false" to the visibility of the dock widget.

When I close the application via QCoreApplication::quit() the dock widget seems to stay visible right before the app is closed. On the next application start the dock widget is shown because the ini-file true"false" to the visibility of the dock widget.

I am running the app solely on Win XP, so I have no idea if this is Windows specific behaviour for QDockWidget.

I use QDockWidget::isHidden() to ask for the dock widgets visibility when quiting my app and to store the visibility.
Any idea where this strange behaviour might come from, or how to store a dock widgets visibility?

high_flyer
9th February 2010, 17:19
Try connecting your settings saving slot to the aboutToQuit () signal.

Boron
11th February 2010, 08:54
This sadly does not help.
The dock widget is still hidden "before" the signal aboutToQuit() is emitted :(.

mrvk
11th February 2010, 09:00
Override the closeEvent of the mainWindow to save your settings.