Qt-interest Archive, January 2007
lineEdit expand to size of parent qscrollview
Message 1 in thread
hi,
i got a simple form where i want to place a qscrollview and in there as
content a e.g. lineEdit. Now i can add the scrollview this way
QScrollView *sv = new QScrollView( this );
static_cast<QHBoxLayout*>( layout() )->addWidget( sv );
Theres all ok, when i open the form, the qscrollview is as big as the
main-form, and it resizes with the main-form. All ok.
But now i try to insert a e.g. lineEdit with these lines
QLineEdit* le = new QLineEdit( sv.>viewport() );
sv->addChild( le );
When i open now the app, the scrollview is as big as main-form, but
inside the scrollview , in the left upper corner sits the lineEdit, as
small as it gets :(.
How can i implement the lineEdit into the scrollview or viewport of the
scrollview, so that it uses the horizontal-size of the scrollview?
thanks for help
flo
--
[ signature omitted ]
Message 2 in thread
hi,
when i use the code from http://doc.trolltech.com/3.3/qscrollview.html
QScrollView* sv = new QScrollView(...);
QVBox* big_box = new QVBox(sv->viewport());
sv->addChild(big_box);
You can go on to add arbitrary child widgets to the single child in the
scrollview as you would with any widget:
QLabel* child1 = new QLabel("CHILD", big_box);
QLabel* child2 = new QLabel("CHILD", big_box);
QLabel* child3 = new QLabel("CHILD", big_box);
the childs are not so big in size (horizontaly or vertically) as the
viewport of the scrollview is ? Is that normal, and how can i code it so
that the childs have horizontally the same size as the viewport of the
scrollview?
thanks
flo
On Sun, 14 Jan 2007 02:09:39 +0100
inflo <inflo@xxxxxx> wrote:
> hi,
> i got a simple form where i want to place a qscrollview and in there
> as content a e.g. lineEdit. Now i can add the scrollview this way
>
> QScrollView *sv = new QScrollView( this );
> static_cast<QHBoxLayout*>( layout() )->addWidget( sv );
>
> Theres all ok, when i open the form, the qscrollview is as big as the
> main-form, and it resizes with the main-form. All ok.
>
> But now i try to insert a e.g. lineEdit with these lines
>
> QLineEdit* le = new QLineEdit( sv.>viewport() );
> sv->addChild( le );
>
> When i open now the app, the scrollview is as big as main-form, but
> inside the scrollview , in the left upper corner sits the lineEdit, as
> small as it gets :(.
>
> How can i implement the lineEdit into the scrollview or viewport of
> the scrollview, so that it uses the horizontal-size of the scrollview?
>
> thanks for help
> flo
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body. List archive and
> information: http://lists.trolltech.com/qt-interest/
>
--
[ signature omitted ]