PDA

View Full Version : Effecinecy for a GU Interface



salmanmanekia
2nd June 2010, 11:56
I have written a piece of code which has layouts ,buttons ,labels and i have defined them as follows

read->setFixedHeight(30);
read->setFixedWidth(100);

setGrid->setFixedHeight(30);
setGrid->setFixedWidth(100);

run->setFixedHeight(30);
run->setFixedWidth(210);

gridLayout->addLayout(formLayout,0,0,10,10,Qt::AlignLeft);
gridLayout->addWidget(read,20,0,5,5,Qt::AlignLeft);
gridLayout->addWidget(setGrid,20,5,5,5,Qt::AlignLeft);
gridLayout->addWidget(run,30,0,10,10,Qt::AlignLeft);

my question is that if i change one of the value of the parameter then my whole design is out of shape...as it is quite obvious why ?,my question is that is there any other way to define these and not hard code it...Thanks

salmanmanekia
2nd June 2010, 12:02
sorry for posting this twice...:)

squidge
2nd June 2010, 13:29
If you don't want to hard code it, why not use QtDesigner? It's still hardcoded in a way, but at least that code be easily updatable, as a simple run of UIC will update it all from the .ui file.

CeeKey
2nd June 2010, 14:24
If you would like to set Widgets in an exact orientation, there is no other way. But if you use another layoutmanager like QHBoxLayout, you do not have to hard code the layout of these widgets.