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

wanneng yangguosdxl at gmail.com
Tue Aug 17 03:20:25 CEST 2010


On 2010年08月16日 17:08, Alessandro Portale wrote:
> 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
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>    

Thanks for all of you!
Now I know how to resolve the problem. You are right, it must use the 
QScrollArea. I use it, and all of it are ok.

-- 
--------------------------
万能
普赛科技




More information about the Qt-interest-old mailing list