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

QScrollArea::sizeHint does not include as-needed scroll bars

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • Not Evaluated
    • None
    • 4.6.2
    • None

    Description

      QScrollArea::sizeHint returns a size based on its widget, and includes additional space for the scroll bars only if the scroll bar policy is Qt::ScrollBarAlwaysOn.

      I think QScrollArea::sizeHint should include this space if the policy is anything but Qt::ScrollBarAlwaysOff, since this allows QScrollAreas using Qt::ScrollBarAsNeeded to grow to a size where the scroll bars can be removed.

      This can be seen if the QScrollArea has enough space to grow in one dimension but not both. If a QScrollArea using Qt::ScrollBarAsNeeded was displaying a 512x512 image, sizeHint returns 512x512.

      If that widget can only be given 200 pixels vertically then the vertical scroll bar must be shown, which means the widget should ideally get 512+15 pixels horizontally (assuming scroll bars are 15 pixels thick).

      If the widget is simply given 512, as per its sizeHint, the horizontal scroll bar is also made visible (since the widget can only show 512-15 pixels worth of image horizontally, due to the vertical scroll bar).

      If the scroll bar was included in the sizeHint then the widget would have requested 512+15 pixels horizontally and, assuming it could get it, the horizontal scroll bar would never be seen.

      Attachments

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

        Activity

          People

            monsen Marius Bugge Monsen
            refnum Dair Grant
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes