Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Scroll Area Refuses To Work



  • Using the Designer within QT Creator I am trying to set up a simple scroll area. I have a very long grid layout that is filled with various items, and am trying to create a scroll area that contains just this layout. So far I am unable to get it to scroll.

    Literal Steps:
    Have Grid Layout(filled with items) -> Drop in new scroll area into window -> Put much larger (vertically) layout within scroll area

    I have read about people having issue when trying to code this, but I am simply using the Designer for this. I also read up on the size hint documentation affecting this but am confused as to if that is actually a problem, as I haven't messed around with it at all for this specific problem.

    Additional Info:
    I have made various other large dummy layouts to test, and the scroll area will not scroll with them either. I have even taken individual items, dropped them into the scroll area, and then moved them out of the scroll area's visible area; none of this has worked. Also, my style sheet does not do anything to scroll areas either.


  • Lifetime Qt Champion

    Hi,

    Don't put your layout in the QScrollArea, put it on a widget that you set on the QScrollArea.



  • @sgaist
    Thank you for the reply. To clarify, the Scroll Area aromatically comes with a QWidget child in Designer, so I have always been putting my layout in said QWidget.

    Looks just like this: Scroll Area -> Widget -> Grid Layout -> Stuff (Note: Scroll Area has no other children)

    After trying many things, simply changing the min size limits of the inner QWidget finally fixed it.


Log in to reply