grid->addWidget(compass,0,0,1,2); grid->addWidget(leftLabelArea,1,0); grid->addWidget(rightLabelArea,1,1); grid->setRowStretch(0,1); grid->setRowStretch(1,0);
if you want the compass to always keep the same size so it does not get distorted, you might try grid->addWidget(compass,0,0,1,2,Qt::AlignCenter); If you want to have the compass grow but keep square you probable ahve to do something with its resizePolicy On Tue, May 8, 2012 at 2:25 AM, Christian Gagneraud <ch...@techworks.ie>wrote: > Hi list, > > I'm trying to create a simple composite widget as following: > - Container is a QGroupBox > - Top widget is a compass (square shaped design based on the analog > clock example) > - Below the compass are 2 pairs of labels/value > > I would like the compass to occupy as much space as possible and the 2 > labels/values to just "stick" below the compass. > I have tried different solutions using the QVBoxLayout and the > QGridLayout, with not much success. In all cases, I had the labels > "pushing" the compass toward the top and causing its size to be too small. > Is it a way to tell the layout to always keep the compass' size as big > as possible? Basically I would like that the compass width follows the > QGroupBox's width, and pushing or pulling the 2 pairs of labels/values > up and down (due to the compass square constraint) > > Regards, > Chris > > > > > -- > Christian Gagneraud, > Embedded systems engineer. > Techworks Marine > 1 Harbour road > Dun Laoghaire > Co. Dublin > Ireland > Tel: + 353 (0) 1 236 5990 > Web: http://www.techworks.ie/ > _______________________________________________ > Interest mailing list > Interest@qt-project.org > http://lists.qt-project.org/mailman/listinfo/interest >
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest