[Qt-interest] setWidget() problem for QScrollArea
Anton Chernov
mechernov at gmail.com
Mon Jul 18 09:06:44 CEST 2011
Put a layout in the wid Widget
QHboxLayout* layout = new QHboxLayout(wid);
QPushButton *button = new QPushButton(“click me”,wid);
layout->addWidget( button );
2011/7/18 Sujan Dasmahapatra <sdh at lmwindpower.com>:
> Dear Friends
>
> I am trying to create some widgets on the QScrollArea…I can create them on
> a widget and set that widget to QScrollArea OR I can directly create on the
> ScrollArea.
>
> When I am creating it on the widget and setting that widget on QScrollArea I
> can see the controls but when I am creating on the QScrollArea directly not
> setWidget() function then I am able to see them.
>
> Why is this happening any suggestions.
>
>
>
> e.g
>
> QScrollArea * area = new QScrollAreal;
>
> QWidget *wid = new QWidget(area);
>
> area->resize(800,600);
>
> area->setWidget(wid);
>
> area->show();
>
>
>
> QPushButton *button = new QPushButton(“click me”,wid);
>
> button->setGeometry(0,0,200,50);
>
> button->show();
>
> Kind Regards,
>
>
>
>
>
> This is not working. Instead if I don’t create a widget and simply I put
>
> QPushButton *button = new QPushButton(“click me”,area);
>
> Then its working . its creating the button…But in this case I cannot scroll
> because there’s not widget to move…
>
> Please give some suggestions Thanks sujan
>
>
>
>
>
> Sujan Dasmahapatra
> Project Leader, Aero Group
> Aero Group
>
> Tel +91 80 66470248
> Mob
>
> sdh at lmwindpower.com
>
>
>
> LM Wind Power Blades
>
> lmwindpower.com
>
>
>
> Together we capture the wind to power a cleaner world
>
> ________________________________
>
>
>
> This e-mail and any attachments are confidential. If you are not the named
> or intended recipient, please notify the sender immediately and do not
> disclose the contents to any other person, use it for any purpose, or store
> or copy the information in any medium. Any unauthorized disclosure, use or
> storage is prohibited and might be unlawful.
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>
>
More information about the Qt-interest-old
mailing list