Important: Please read the Qt Code of Conduct -

Restoring maximized Widgets

  • I am writing an application using the latest Qt libraries (4.7.1). It consists of a QMainWindow and several QDockWidgets. The DockWidgets have custom title bar widgets which enable the user to maximize them. This is of particular importance in a multi-monitor setup: main application window is displayed on one monitor, some DockWidget on the other monitor.

    If you minimize the main window, all dock widgets are minimized as well. However, as soon as you restore the main window, the maximized dock widgets are not restored properly. Although they appear to be still maximized (isMaximized returns true - resizing and moving is disabled), they are not at the right position (top-left corner).
    Calling showNormal(); showMaximized(); consecutively on a showEvent (in case the widget was maximized) solves the problem.

    Am I doing something wrong, or is Qt behaving in a erroneous way?
    Any help would be greatly appreciated!

  • Sounds like a Qt bug --- QMainWindow::saveState / restoreState should handle everything.

Log in to reply