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

QWidget::windowState() gets out of sync

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P2: Important P2: Important
    • 5.0.1
    • 5.0.0
    • None
    • qtbase/stable (eebf42c) - X11 & Win7
    • 3295378325c1b4567379d641f05e9eadea35040c

      Steps:

      • maximize QWidget(Window)
      • minimize the window
      • restore the window
        -> the window reports that it's still minimized
      #include <QtWidgets>
      
      static QString windowStateString(Qt::WindowStates states)
      {
          QStringList str;
          if (states & Qt::WindowMinimized)
              str += "Qt::WindowMinimized";
          if (states & Qt::WindowMaximized)
              str += "Qt::WindowMaximized";
          if (states & Qt::WindowFullScreen)
              str += "Qt::WindowFullScreen";
          if (states & Qt::WindowActive)
              str += "Qt::WindowActive";
          if (states == Qt::WindowNoState)
              str += "Qt::WindowNoState";
          return str.join(",");
      }
      
      class Window : public QWidget
      {
      protected:
          void changeEvent(QEvent *event)
          {
              QWidget::changeEvent(event);
              if (event->type() == QEvent::WindowStateChange)
                  setWindowTitle(windowStateString(windowState()));
          }
      };
      
      int main(int argc, char* argv[])
      {
          QApplication app(argc, argv);
          Window w;
          w.showMaximized();
          return app.exec();
      }
      

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

            srutledg Shawn Rutledge
            jpnurmi J-P Nurmi
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes