Reputation: 6345
For the following, I get self.page1.sizeHint()
and self.page1.minimumSizeHint()
both as QSize(-1, -1)
. Does anyone know why? I was expecting the minimum size hint should be at least the size of the label.
# ...
self.page1 = QtGui.QWidget()
self.page1.setObjectName("page_General")
self.label_Server = QtGui.QLabel(self.page1)
self.label_Server.setGeometry(QtCore.QRect(20, 20, 39, 13))
self.label_Server.setObjectName("label_Server")
print self.page1.sizeHint(), self.page1.minimumSizeHint()
Thanks
Upvotes: 2
Views: 694
Reputation: 12911
The default implementation of sizeHint()
:
This property holds the recommended size for the widget.
If the value of this property is an invalid size, no size is recommended.
The default implementation of sizeHint() returns an invalid size if there is no layout for this widget, and returns the layout's preferred size otherwise.
Same goes for minimumSizeHint
.
Upvotes: 3