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

QMainWindow::changeEvent called with isMinimized() == true when removing "WindowMinimized" window state

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P2: Important P2: Important
    • None
    • 5.11.1
    • Widgets: Main Window
    • None
    • Arch Linux, using X.Org version 1.20.0, xfce4 version 4.12, xwm version 4.12.4.
    • Linux/X11

      The attached example project is a minimal example of an application where this bug occurs. When running the application, the main window is shown with the maximized window state. Now when you minimize the window and afterwards click the tray icon, the window is shown for a very short time (some milliseconds) and immediately disappears again. When you now click thy tray icon once again, the window is shown as expected.

      The expected behaviour is that the window is not hidden after being shown after the first click on the tray icon.

      The reason why the window is hidden immediately after being shown the first time you click the tray icon is that the changeEvent event handler is called and isMinimized() returns true after the call to

      setWindowState(windowState() & ~Qt::WindowMinimized);
      

      in mainwindow.cpp, line 26.

       

      Changing this line to

      setWindowState(Qt::WindowMaximized);
      

      leads to the same behaviour.

       

      I'd expect that isMinimized() is not true after setting the window state to maximized. So is this a bug or am I doing something wrong here?

        1. qt-minimize-hide-show-debug.pro
          1.0 kB
        2. mainwindow.h
          0.4 kB
        3. mainwindow.cpp
          0.7 kB
        4. main.cpp
          0.2 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            somerandomguy somerandomguy
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes