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

QWidget::windowState() gets out of sync

    XMLWordPrintable

Details

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

    Description

      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();
      }
      

      Attachments

        Issue Links

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

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes