PDA

View Full Version : Qt Designer: which field corresponds to sizeHint()?



33333
13th June 2014, 02:18
I'm looking at QtDesigner part of QtCreator 2.5. We have the following size related fields list on the right for a widget. No "sizeHint" is listed. Which if any corresponds to QWidget::sizeHint()?


geometry
sizePolicy
minimumSize
maximumSize
sizeIncrement
baseSize


A corollary question. I notice QWidget::sizeHint() is a constant method. How do I affect its return value from the outside? Is that possible?

Thanks.

anda_skoa
13th June 2014, 09:28
sizeHint() is not a property, it is a QSize value that, toegther with size policy, is used by layout managers to determine the overall size needed for a widget's children.

Unless the size policy is set to fixed or setFixedSize() was called, the value usually depends in the widget's contents.
E.g. text length and font height for a label.

If you change how a widget works by subclassing it and your change affects the needed space, then overwrite sizeHint() to reflect that changed requirements

Cheers,
_