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

QSpinBox minimum size is very large if constructor is called with null parent

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • 5.13.2
    • Widgets: Main Window
    • None
    • Windows

      If you create QSpinBox without parent in its constructor, then its minimum size will be very large. It seems that it happens because QAbstractSpinBox::minimumSizeHint calls sizeFromContents which tries to determine size for up-down buttons in QCommonStyle::subControlRect using current widget size. As real widget size is not updated yet, it uses default values of 100x30 for widgets with parent in constructor and 640x480 for widgets without, leading to very large minimum size. Anyway, the fact that minimumSizeHint depends on current widget size and does not invalidate itself on size change is very strange.

      Attached small example of this behavior.

       

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

            chehrlic Christian Ehrlicher
            alexey.telishev Alexey Telishev
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes