[Qt-interest] How to put a QLayout in a QScrollArea ?

Eric Clark eclark at ara.com
Mon Dec 14 18:12:07 CET 2009


Stephen,

Create a QWidget and set its layout to be the QVBoxLayout and then add the widget as the widget in the scroll area, like so:

QWidget *widget = new QWidget(parent);
QVBoxLayout *layout = new QVBoxLayout(widget);

myScrollArea->setWidget(widget);

Thanks,
Eric

From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] On Behalf Of Stephen Collyer
Sent: Monday, December 14, 2009 10:53 AM
To: qtInterest
Subject: [Qt-interest] How to put a QLayout in a QScrollArea ?

I want to create a scrollable widget containing a QVBoxLayout of other widgets. However, QScrollArea::setWidget() wants a QWidget*, not a QLayout*.

Is there straightforward way to do this ?

--
Stephen Collyer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091214/6f3419dd/attachment.html 


More information about the Qt-interest-old mailing list