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

Resizing widget that has QScrollArea with FixedSize layout, causes infinite resize loop due to scrollbars

    XMLWordPrintable

Details

    • 3841a7dd49667ceabdcbc416fa1e149bed7ed86e

    Description

      When having the following widget structure:
      QWidget / QStackedLayout
      -> QScrollArea [widgetResizable = true]
      --> QWidget / QBoxLayout (or QGridLayout) [sizeConstraint = SetFixedSize]
      ---> QPushButton
      And resizing the Widget before calling show, causes infinite resize loop due to scrollbars calling setGeometry().

      The loop looks like:

      • QScrollArea::resizeEvent
      • QScrollAreaPrivate::updateScrollBars
      • QAbstractSlider::setRange (2 times)
      • rangeChanged signal emitted
      • slot QAbstractScrollAreaPrivate::_q_showOrHideScrollBars
      • QAbstractScrollAreaPrivate::layoutChildren
      • QWidget::setGeometry
      • QResizeEvent send
      • Return to first; QScrollArea::resizeEvent

      This problem does not reproduce if show() is called before the resize() for the widget. Documentation states that calling resize() before show() is allowed, but the scrollbars are calling setGeometry(), which is forbidden inside the ResizeEvent according to the documentation.

      Steps to reproduce:

      • Run attached sample
      • Press "Clone" button to create a new widget with specified size
      • EXPECTED: Widget is properly created and shown
      • ACTUAL: Widget is created, but enters an infinite loop of ResizeEvents

      Attachments

        1. qtbug56280.zip
          2 kB
        2. qtbug56280.zip
          1 kB

        Issue Links

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

          Activity

            People

              tvete Paul Olav Tvete
              jussi_witick Jussi Witick
              Votes:
              2 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes