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

Scroll areas preferred sizes are bounded to some obscure magic values

    XMLWordPrintable

Details

    Description

      In QScrollArea::sizeHint(), the return value is bounded to 36*fontHeight / 24*fontHeight:

      int h = fontMetrics().height();
      ...
      return sz.boundedTo(QSize(36 * h, 24 * h));

      In QGraphicsView::sizeHint(), the return value is bounded to 3/4 of the desktop size:

      ...
      baseSize = baseSize.boundedTo((3 * QApplication::desktop()->size()) / 4);
      ...

      This puts some restrictions on using QScrollArea or QGraphicsView in a layout, since the layout might not resize the component as large as it could, but instead showing scrollbars while there is still enough space available around the scroll area. This can also lead to some subtle application bugs, since it only occurs when the preferred size of the components (the size of the widget or graphics scene which is scrolled) exceeds those bounds.

      The framework should not impose such a restriction (especially not with magic values like 3/4 or 36/24) on the return value of sizeHint().

      Attachments

        1. main.zip
          727 kB
        2. screenshot-1.jpg
          screenshot-1.jpg
          59 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            peppe Giuseppe D'Angelo
            littletux Andreas Fester
            Votes:
            3 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes