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

QMainWindow::restoreGeometry() doesn't work on dual onitor

    XMLWordPrintable

Details

    Description

      QMaindWindow::restoreGeometry() does not work correct if QMainWindow is maximized on secondary monitor.

      This can be reproduced with following example on window vista.

      #include <QtGui>
      MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
      {

      QLabel *label = new QLabel("Please move the window position on second screen and maximiz and then close,Then restart the app", this);
      label->setAlignment(Qt::AlignCenter);
      setCentralWidget(label);
      QSettings settings("MyCompany", "MyApp");
      restoreGeometry(settings.value("Geometry/MainWindow").toByteArray());
      }

      void MainWindow::closeEvent(QCloseEvent *e)
      {
      QSettings settings("MyCompany", "MyApp");
      settings.setValue("Geometry/MainWindow", saveGeometry());
      QMainWindow::closeEvent(e);
      }

      Attachments

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

        Activity

          People

            monsen Marius Bugge Monsen
            smk smk
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes