[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:
    http://tinypic.com/r/1zv9y5s/5
    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);
    scroll->setWidget(central);
    scroll->setWidgetResizable(true);
    vbox2->addWidget(scroll);@

    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
 

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