PDA

View Full Version : Problem while using QFormlayout inside a QGroupbox



Schreihals
11th July 2012, 11:39
Hey,

i've got a problem while using a qformlayout inside a qgroupbox..

if my screenresolution is to small, i get a layout like this:

7995

the code i'm using looks like this:



QFormLayout *formLayout = new QFormLayout();
formLayout->addRow(tr("Store Images"), myCheckbox);
formLayout->addRow(tr("Store Image Path"), myLineEdit)
QxtGroupBox* gb = new QxtGroupBox(tr("&Settings"), this);
mainLayout->addWidget(gb);


Someone a idea how i can fix this problem?

thanks already for your answer..

regards. :)

high_flyer
11th July 2012, 12:41
Set margins and size policies to your widgets.
Make sure that the overall size is not to large for your screen.

Schreihals
11th July 2012, 12:43
hmm - ok i'll have a try, but setting all size policies by hand is a lot of work..

i tried to use a scollarea, but this doesn't work either (or is a scrollarea just the wrong widget?)

high_flyer
11th July 2012, 12:44
tried to use a scollarea, but this doesn't work either
What do you mean by "doesn't work"?
Show your code.

Schreihals
11th July 2012, 12:47
like above, but before doing this:



mainLayout->addWidget(gb);

i've done this:


QScrollArea* sa = new QScrollArea();
QHBoxLayout* hl1 = new QHboxLayout();
hl1->addWidget(sa);
sa->setLayout(formLayout);
gb->setLayout(hl1);

high_flyer
11th July 2012, 12:50
Where is sa->setWidget()?

Schreihals
11th July 2012, 12:58
uuups..

which widget is best for adding a layout before adding to scrollarea? i thought about a QFrame?

this doesn't work..



QWidget* w = new QWidget();
w->setLayout(formLayout);
sa->setWidget(w);


then my box is just empty :(

forget about it.. pebcak, its working fine :)