Important: Please read the Qt Code of Conduct -

How to put many controls in a window with scrollbars?

  • In my case, that are hundres of buttons to show, I need a scroll view.
    ( The buttons are arranged by categories, the user should see all of them at a glance.)

    What's the proper way?

    I have tried to put a QWidget (with adjustSize) in QScrollArea, it works.
    But adjustSize has limits, the doc says:

    For windows, the screen size is also taken into account. If the sizeHint() is less than (200, 100) and the size policy is expanding, the window will be at least (200, 100). The maximum size of a window is 2/3 of the screen's width and height.

  • Any chance you'd rather want a QTableView/QListView with a delegate that looks like a button instead?

  • @VRonin
    You are on a mission to drastically reduce the total number of QWidgets in The Universe, aren't you? ;)

  • Lifetime Qt Champion

    Only when they are used with setIndexWidget() ;)

    In this case its more due to the fact that a QScrollArea with
    "hundres of buttons" gets slow pretty fast on non
    Desktop class devices.

    So View + Delegate is the sure road to better performance and
    in many cases the preferred way which you likely already know. :)

Log in to reply