Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-2105

Floating Toolbar not Repositioned from Disconnected Second Display

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P3: Somewhat important P3: Somewhat important
    • 4.6.0
    • 4.4.0
    • Widgets: Main Window
    • None

      Floating toolbars and dock widgets can get stuck off screen under the following circumstances:

      A user with dual monitors opens an application with floating toolbars
      The user then repositions the application's toolbar on the secondary screen.
      The user closes the application, where a call to saveState() saves the positions
      The user then removes the secondary monitor and reopens the application.

      The application uses restoreState() to position the toolbars, and the toolbars are located offscreen.

      QMainWindow::saveState()/restoreState() could be a bit smarter, and check somehow if the positions that it restores windows too are visible with the current screen.

      This is reproduceable on windows and mac using the following patch:

      ==== examples/mainwindows/application/mainwindow.cpp#1 -examples/mainwindows/application/mainwindow.cpp ====
      @@ -250,7 +250,11 @@
      QSettings settings("Trolltech", "Application Example");
      QPoint pos = settings.value("pos", QPoint(200, 200)).toPoint();
      QSize size = settings.value("size", QSize(400, 400)).toSize();

      • resize(size);
        + QByteArray positions = settings.value("positions").toByteArray();
        +
        + restoreState(positions);
        +
        + resize(size);
        move(pos);
        }
        //! [35] //! [36]
        @@ -262,6 +266,8 @@
        QSettings settings("Trolltech", "Application Example");
        settings.setValue("pos", pos());
        settings.setValue("size", size());
        + settings.setValue("positions", saveState());
        +
        }
        //! [38] //! [39]

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            vfm Thierry Bastian (closed Nokia identity) (Inactive)
            dettman Dean Dettman (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes