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

QWidget::windowState() gets out of sync

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Done
    • Affects Version/s: 5.0.0
    • Fix Version/s: 5.0.1
    • Labels:
      None
    • Environment:
      qtbase/stable (eebf42c) - X11 & Win7
    • Commits:
      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

              Assignee:
              srutledg Shawn Rutledge
              Reporter:
              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