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

QWindow::resize() doesn't propagate the new size to the backing QWidget if the main eventloop hasn't started yet

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.3.1, 6.6.0
    • None

    Description

       
      diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp
      index 35a526e..d417e41 100644
      --- a/src/widgets/kernel/qwidgetwindow.cpp
      +++ b/src/widgets/kernel/qwidgetwindow.cpp
      @@ -551,6 +551,13 @@ void QWidgetWindow::updateGeometry()
       
           const QMargins margins = frameMargins();
       
      +    if (geometry().x() != m_widget->data->crect.x() ||
      +        geometry().y() != m_widget->data->crect.y())
      +        m_widget->setAttribute(Qt::WA_Moved);
      +    if (geometry().width()  != m_widget->data->crect.width() ||
      +        geometry().height() != m_widget->data->crect.height())
      +        m_widget->setAttribute(Qt::WA_Resized);
      +
           m_widget->data->crect = geometry();
           QTLWExtra *te = m_widget->d_func()->topData();
           te->posIncludesFrame= false;
      

      The KDEFileDialog platform wrapper runs into this on sync ::exec()ution of the dialog.
      The size is restored for the dialogs windowHandle() QWindow, but while the size is applied on the window, it's not on the widget.

      I added ::processEvents() after the QWindow::resize() call, but that's not sufficient.
      After comparing QWidget::setGeometry() with QWidgetWindow::updateGeometry() I just tried adding those flags =)

      Ultimately, this does not seem entirely sufficient to me - altering the QWindow size should always align the backing QWidget size, but i'm not sure whether unconditionally processing events from the QWindow::resize() function would be any reasonable.

      See
      https://git.reviewboard.kde.org/r/119594/
      and
      https://git.reviewboard.kde.org/r/119593/
      on details.

      Attachments

        1. qwindowsize.cpp
          1 kB
          Thomas Lübking
        For Gerrit Dashboard: QTBUG-40584
        # Subject Branch Project Status CR V

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            luebking Thomas Lübking
            Votes:
            6 Vote for this issue
            Watchers:
            17 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes