Nominate our 2022 Qt Champions!

[SOLVED] Allowing a QVBoxLayout to auto scroll

  • Hi, i have a QVboxLayout which contains a varying amount of buttons.
    when there are too many to fit on screen i would like them to auto scroll using a QScrollArea.

    The QVboxLayout with the buttons in it is inside another QVboxLayout.

    this is what it looks like at the moment:
    as you can see the buttons actually go off screen.

    could anyone push me in the right direction?

    i did have it working how i wanted using a QWidget but this would show in a window on its own.

    Regards, Tim.

  • Never mind!
    @QWidget *central = new QWidget;
    QScrollArea *scroll = new QScrollArea;
    QVBoxLayout *g = new QVBoxLayout(central);

    then i add my buttons to g

  • Lifetime Qt Champion

    Great you found out !

    Could you also update the thread's title to solved ? So other forum users may know that a solution has been found :)

  • yeah, one sec

Log in to reply