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

Investigate and define in the documentation when are expose events dispatched.

    XMLWordPrintable

Details

    Description

      There have been several bug reports regarding missing expose events when resizing (shrinking) windows: QTBUG-51038 (win) and QTBUG-54040 (x11). Documentation does not guarantee expose events for the above pre-conditions (actually it does not guarantee this also for resize to a larger size):

      void QWindow::exposeEvent(QExposeEvent *ev)

      The expose event (ev) is sent by the window system whenever the window's exposure on screen changes.

      The application can start rendering into the window with QBackingStore and QOpenGLContext as soon as it gets an exposeEvent() such that isExposed() is true.

      If the window is moved off screen, is made totally obscured by another window, iconified or similar, this function might be called and the value of isExposed() might change to false. When this happens, an application should stop its rendering as it is no longer visible to the user.

      A resize event will always be sent before the expose event the first time a window is shown.

      Nevertheless some code seem to depend on this, as reported in QTBUG-51038. So to keep the compatibility we simply dispatch synthetic expose events when necessary. Maybe a better solution would be too fix the code that rely only on the expose event to trigger rendering to treat resize events in similar way. This might need a new application attribute.

      See also comments on https://codereview.qt-project.org/#/c/197925/

      I really welcome changes to share more QPA code/workarounds/tweaks between plugins, but in this case I'm hesitant. A few concrete issues:

      1. The patch needs a rebase, things have changed a lot in dev in this area now, especially on macOS, but also in the way we propagate geometry changes

      2. Any logic that synthesises events, as a way of helping platforms that are not sending the events Qt expects, should live in QGuiApplication, similar to QGuiApplicationPrivate::processExposeEvent

      3. Have we defined QExposeEvent as the only event in Qt that says "you should paint"? A lot of our examples also call their internal paint code on QResizeEvent, why isn't that enough? We should clarify this, and document it.

      4. If we want to share this code in QGuiApplicationPrivate, I'd much prefer we use a (badly named, we should change it) QPlatformIntegration::StyleHint to indicate that NeedsExposeOnResizeShrink (or something like that), instead of keeping track of events, single-shot timers, etc etc.

      Attachments

        Issue Links

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

          Activity

            People

              sletta Gunnar Sletta
              paeglis Gatis Paeglis
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes