QScrollArea layout tips in designer?



  • Hi,
    I meet an inconvenient operation when adding a lot of widgets into a QScrollArea. If I set layout first, then I can see scrollbar, but it is not possible to put the widgets to any position I want when layout is set. If I don't set layout, QScrollArea can only see the size as much as screen size. I can not put widgets to area outside the screen .
    How to you deal with such situation?

    Thanks!


  • Qt Champions 2017

    Hi
    Layouts determine where widgets are placed. You cannot freely position them.
    However, you could use a Grid layout. That allows widgets to be placed on a grid
    and offer more freedom. But no layout allows freely placing widgets in any position you wish.

    Note however, with all the layout you can drag widgets to a position and the other widgets will be moved.
    A blue line is shown for the insertion point.
    alt text

    However, there is widgetResizable. If you set it to false and call
    widget()->resize() to something larger than screen. it might allow scrolling with no
    layouts. You might need to set scrollbars to show always.
    alt text



  • @mrjj
    Your first tip is good. But sometimes I want to append a sub-layout and then put two or more widget into it.


  • Moderators

    @Mr-Pang said in QScrollArea layout tips in designer?:

    But sometimes I want to append a sub-layout and then put two or more widget into it

    Then do it. A layout can contain other layouts and so on...


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.