PDA

View Full Version : layout for display functions



therealjag
2nd March 2006, 20:48
hey there i am making a grid layout and i have 2 QLineEdit displayboxs with 1 under the other. is there a way to make the display boxes smaller in width:




display = new QLineEdit("0");
display->setReadOnly(true);
display->setAlignment(Qt::AlignCenter);
display->setMaxLength(10);
display->installEventFilter(this);
QFont font = display->font();
font.setPointSize(font.pointSize() + 8);
display->setFont(font);

display2 = new QLineEdit("0");
display2->setReadOnly(true);
display2->setAlignment(Qt::AlignCenter);
display2->setMaxLength(10);
display2->installEventFilter(this);
QFont font2 = display2->font();
font2.setPointSize(font2.pointSize() + 8);
display2->setFont(font2);

jpn
2nd March 2006, 22:02
Set size hints for the line edits or use spacer items to "pack" them to a certain corner.

wysota
2nd March 2006, 22:32
You can use different sizePolicy settings to manipulate the behaviour of widgets.