Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Why are scroll area's preferred sizes bounded to some magic values?
Forum Updated to NodeBB v4.3 + New Features

Why are scroll area's preferred sizes bounded to some magic values?

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 994 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    littletux
    wrote on last edited by
    #1

    In QScrollArea::sizeHint(), the return value is bounded to 36fontHeight / 24fontHeight:
    @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);
    @

    Why is this implemented as the default behavior? It 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.

    The solution is certainly to subclass QScrollArea/QGraphisView and reimplement sizeHint() without the boundedTo() call, but should this not be the default behavior of the framework?

    1 Reply Last reply
    0
    • EddyE Offline
      EddyE Offline
      Eddy
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      I think you have a point there.

      You can fill a feature request on the "bug report system":http://bugreports.qt-project.org and post the link here, so others can vote for it.

      [edit: Corrected link SGaist]

      Qt Certified Specialist
      www.edalsolutions.be

      1 Reply Last reply
      0
      • L Offline
        L Offline
        littletux
        wrote on last edited by
        #3

        Hi Eddy,

        thanks for your reply. Just wanted to check if I missed something obvious with those restrictions ;)

        Here is the link to the bug (I think its a bug rather than a feature request): https://bugreports.qt-project.org/browse/QTBUG-38369

        Thanks,
        Andreas

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved