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

OSX: Regression introduced by the fix for QTBUG-44313: dialog flickers during resize if it calls setGeometry() in resizeEvent handler

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P1: Critical
    • Resolution: Done
    • Affects Version/s: 5.4.2, 5.5.1, 5.6.0 Beta, 5.6.0
    • Fix Version/s: 5.11
    • Component/s: GUI: Painting
    • Environment:
      OS X Yosemite 10.10.3
    • Platform/s:
      macOS

      Description

      Overview
      The fix for QTBUG-44313 introduced clearing QCocoaWindow::m_backingStore when QCocoaWindow::m_platformWindow->m_inSetGeometry is true. Leaving the backing store null causes a subsequent paint operation to abort, leaving the dialog momentarily undrawn (transparent).

      Deeper Analysis
      This line is causing the dialog to momentarily disappear from the screen:

      qcocoawindow.mm: QCocoaWindow::setCocoaGeometry()
      [m_nsWindow setFrame:[m_nsWindow frameRectForContentRect:bounds] display:YES animate:NO];
      

      That's happening because of this line deeper in the callstack:

      qnsview.mm: QNSView::drawRect
      if (m_backingStore.isNull()
              return;
      

      Recommended Fix - DEPRECATED, SEE COMMENTS FOR REVISED FIX
      I've applied this locally on top of Qt 5.4.2 with great success. Instead of clearing the backing store, do the following:

      qnsview.mm
              {
                  m_backingStore = QImage(geometry.size(), m_backingStore.format());
                  QEvent updateRequest(QEvent::UpdateRequest);
                  QCoreApplication::sendEvent(m_window, &updateRequest);
               }
      

      That creates a new backing store at the correct new size and then forces the widget to synchronously draw at that size to fill the new backing store with correct visuals.

        Attachments

          Issue Links

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

            Activity

              People

              • Assignee:
                sorvig Morten Sørvig
                Reporter:
                kkelly@tableausoftware.com Keith F. Kelly
              • Votes:
                8 Vote for this issue
                Watchers:
                11 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes