Size of QCheckBox
-
Allo,
In order to get the size of a text string, I doQString qstring; QRect rect; QCheckBox TheCheckBox; QFontMetrics *fm; fm=new QFontMetrics(pFONTSmallFont[0]); qstring=”A String”; rect=fm->boundingRect(qstring); width=rect.width(); height=rect.height(); TheCheckBox->setGeometry(x, y, width, height);
but I think that width is not sufficient. What about the size of the box thing that appears to the left side?
I guess I need a
size=TheCheckBox->GetCheckBoxThingSize(); TheCheckBox->setGeometry(x, y, size.width+width, size.height+height);
-
Set the string for your QCheckBox, call sizeHint/minimumSizeHint
-
@stretchthebits Why are you manually trying to determine the size of widgets at all?
-
@ChrisW67 said in Size of QCheckBox:
@stretchthebits Why are you manually trying to determine the size of widgets at all?
I figure out their dimensions, I call setGeometry() for each so that the text fits in them since the user can change the text size that appears on Buttons, edit boxes, checkboxes, radio buttons, list boxes, labels. Also, I resize the window so that all these controls fit in.
-
Use a proper layout instead...