[Qt-interest] I have a problem for add a custom widget to vboxlayout

Alessandro Portale alessandro.portale at nokia.com
Mon Aug 16 11:08:54 CEST 2010


On 8/16/2010 11:03 AM, ext wanneng wrote:
> I have a widget A which inherited from the QWidget, and reimplement its
> paintEvent method, others is not changed.
> then, I add my custom widget A to a QVboxLayout.
>
> But when I run the program, it show the widget A, but not manage the
> size. Its means that When A is out of the view port, the QVboxLayout
> does not create the scroll bar, I think may be there are some other
> methods needed to reimplemented.
>
> Is there anyone can help me? thank you anyway.

To get the behavior you are looking for, you can put your widget into a 
QScrollArea and set the minimum size of your widget accordingly.

http://doc.qt.nokia.com/latest/qscrollarea.html

Hope that helps,
Alessandro




More information about the Qt-interest-old mailing list