PDA

View Full Version : Weird QDockWidget behavior (trigger/toggle/minimize) [solved]



vycke
4th May 2010, 17:45
I have a QMainWidget with a dock on the right side. I add 3 QDockWidgets (actually a derived class from the Qt class). The close button on the Dock Widget, the context menu for the dock widgets, and the View menu item (using the QDockWidget::toggleViewAction() QAction) should all query the user before "closing" the dock (actually hiding it). This is done by connecting the QAction's toggled signal with our slot. Now, using toggled gives us the query as designed... but closing the app also queried the user (I was able to add an 'isClosing' type of check to prevent this)....and minimizing the app also closes/queries. If I switch the connect to triggered, the menus won't query, but the minimize also does not have the problem.

Do I need to keep track of if the app is minimizing? (isVisible() and isMinimized() functions on the main widget doesn't work (I suspect that the app hasn't minimized at the time the toggle is done)) Has anyone else found this issue?

(Using version 4.3.2 .... I can try to push the company to get a newer version, if this is known to be a bug in the version.)

Thanks,
Vycke

vycke
4th May 2010, 19:18
Solved with a bool set on hideEvent()/showEvent() on the Main Window (since minimizing does a hide. but doesn't set the isVisible flag to false according to the docs). It's sort of a work-around, but it works.

Vycke