Important: Please read the Qt Code of Conduct -

How to fit a label to a scroll Window Area in Qt designer?

  • I want to display a lot of icons in a label but as the number of icons is really high, I will need to be able to scroll horizontally and vertically in this label.

    What I did : I created a ScrollArea with a horizontal and vertical scrollbar and also a label. However, it doesn't seem to work. I wrote a long sentence in the label but the scroll bars does not move what is inside the label. Actually, I think the scroll bars only relate to the scroll area but not to the label.

    To summarize : I need a label of fixed size on my form where I would be able to scroll horizontally and vertically.

    1_1545251909670_2018-12-19_20h54_07.png 0_1545251909668_2018-12-19_21h25_32.png

  • Lifetime Qt Champion


    Why are you adding scrollbars to a QScrollArea ? It already has them integrated.

  • I removed them but it still does not work. Should I set WidgetResizable to True or False ? I don't know if I need to set any particular layout ? My label should fit the whole scroll area I guess ? I set the frame shape to WinPanel, is it ok ?

    Actually, all I need is a label where I can scroll in it... I am just looking at the easiest solution for it

  • Lifetime Qt Champion


    • I want to display a lot of icons in a label

    Why not use a ListWidget/ListView set to icon mode
    and left to right flow ?

    alt text
    it can scroll in both direction and also show icons/only show icons.
    alt text

    alt text

Log in to reply