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

Inconsistent handling of "close" w/QWindows

    XMLWordPrintable

Details

    • macOS, Windows
    • 51300566ffe2ece2455e1d0479a556c5dbb3bb8e (qt/qtbase/dev)

    Description

      Generally if you have a QMainWindow containing a QWindow (e.g. by using QWidget::createWindowContainer()):
       
        - if you call QMainWindow::close(), the QWindow receives QEvent::Hide and does the right thing - i.e. I can show it again and everything is ok
        - if you click the close button in the title bar, the QWindow receives QEvent::Close which (might!) call QWindow::destroy()
       
      Tried on macOS 10.12.6 with Qt 5.11.2 and Qt 5.12 from git, and Windows 7 with Qt 5.11.2.
       
      Expectation
      For a window containing a QWindow (in a widget), I would expect clicking on the close button in the title bar to do the same thing as calling close().

      Example
      There are several issues here.

      • Run the example
      • click "Show Raster"
      • this will create and show a window using QRasterWindow & you should see "_RasterContents QPlatformSurfaceEvent(surfaceEventType=SurfaceCreated)"
      • click "Close Raster"
      • this will close the window by calling "close()"
      • click "Show Raster" - this will show it again - all good!

      Now:

      • click the close button on the Raster window's title bar
      • we now get "_RasterContents QPlatformSurfaceEvent(surfaceEventType=SurfaceAboutToBeDestroyed)"? (Problem #1 - why is this happening?)
      • but I don't think anything is actually destroyed...
      • showing it again works...

      Now let's do the same with the 3D example:

      • click "Show 3D"
      • this will create and show a window using QRasterWindow & you should see "_3DContents QPlatformSurfaceEvent(surfaceEventType=SurfaceCreated)"
      • click "Close 3D"
      • this will close the window by calling "close()"
      • click "Show 3D" - this will show it again - all good!

      Now:

      • click the close button on the 3D window's title bar
      • now we get "_3DContents QPlatformSurfaceEvent(surfaceEventType=SurfaceAboutToBeDestroyed)"
      • click "Show 3D"
      • contents are gone! (or crashes on Windows?) (Problem #2 - why are my contents gone?)
      • There is a slight difference here on macOS between 5.11 and 5.12. With 5.11 I get a white background, with 5.12 I get a grey background.

      Bonus problem
      With the raster one, (at least on macOS), when the window is shown and I command-tab away and then back, the contents are not updated until I resize the window. (Problem #3 - it should be updated properly)

      (I will attach the example code after I have a bug number.)

      Attachments

        1. qt5121.png
          qt5121.png
          3 kB
        2. QTBUG-71519.zip
          4 kB
        3. QTBUG-71519-simple.zip
          2 kB

        Issue Links

          For Gerrit Dashboard: QTBUG-71519
          # Subject Branch Project Status CR V

          Activity

            People

              vhilshei Volker Hilsheimer
              asm Andy M
              Veli-Pekka Heinonen Veli-Pekka Heinonen
              Votes:
              4 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes