![]() QSizePolicy:: QSizePolicy()Ĭonstructs a QSizePolicy object with Fixed as its horizontal and vertical policies. See also setHorizontalStretch(), setVerticalStretch(), and controlType(). Use setHeightForWidth() if the preferred height of the widget is dependent on the width of the widget (for example, a QLabel with line wrapping). Member Function Documentation QSizePolicy:: QSizePolicy( QSizePolicy::Policy horizontal, QSizePolicy::Policy vertical, QSizePolicy::ControlType type = DefaultType)Ĭonstructs a QSizePolicy object with the given horizontal and vertical policies, and the specified control type. These flags are combined together to form the various Policy values: See also PolicyFlag, setHorizontalPolicy(), and setVerticalPolicy(). The widget will get as much space as possible. ![]() the horizontal direction of a horizontal slider). The widget can make use of extra space, so it should get as much space as possible (e.g. The sizeHint() is minimal, and sufficient. The sizeHint() is a sensible size, but the widget can be shrunk and still be useful. ![]() The widget can be expanded, but there is no advantage to it being larger than sizeHint() (the default QWidget policy). The sizeHint() is best, but the widget can be shrunk and still be useful. It cannot be larger than the size provided by sizeHint(). The widget can be shrunk any amount without detriment if other widgets need the space (e.g. It cannot be smaller than the size provided by sizeHint(). the horizontal direction of a push button). The widget can be expanded, but there is no advantage to it being larger (e.g. the vertical direction of a push button). The QWidget::sizeHint() is the only acceptable alternative, so the widget can never grow or shrink (e.g. This enum describes the various per-dimension sizing types used when constructing a QSizePolicy. See also setControlType() and controlType(). It stores an OR combination of ControlType values. The ControlTypes type is a typedef for QFlags. The default type, when none is specified.Ī QFrame instance with QFrame::HLine or QFrame::VLine. See also QSize, QWidget::sizeHint(), QWidget::sizePolicy, and QLayoutItem::sizeHint(). Use the expandingDirections() function to determine whether the associated widget can make use of more space than its sizeHint() function indicates, as well as find out in which directions it can expand.įinally, the QSizePolicy class provides operators comparing this size policy to a given policy, as well as a QVariant operator storing this QSizePolicy as a QVariant object. The hasHeightForWidth() function returns the current status of the flag indicating the size hint dependencies. Alternatively, use the transpose() function to swap the horizontal and vertical policies and stretches. The current size policies and stretch factors be retrieved using the horizontalPolicy(), verticalPolicy(), horizontalStretch() and verticalStretch() functions. The flag indicating whether the widget's sizeHint() is width-dependent (such as a menu bar or a word-wrapping label) can be set using the setHeightForWidth() function. The stretch factors can be set using the setHorizontalStretch() and setVerticalStretch() functions. The horizontal and vertical policies can be set in the constructor, and altered using the setHorizontalPolicy() and setVerticalPolicy() functions. It also contains a flag to indicate whether the height and width of its preferred size are related. ![]() QSizePolicy contains two independent QSizePolicy::Policy values and two stretch factors one describes the widgets's horizontal size policy, and the other describes its vertical size policy. You can change this for a specific widget by changing its QWidget::sizePolicy property. Each widget returns a QSizePolicy that describes the horizontal and vertical resizing policy it prefers when being laid out. The size policy of a widget is an expression of its willingness to be resized in various ways, and affects how the widget is treated by the layout engine. Operator=(const QSizePolicy & other) const Operator!=(const QSizePolicy & other) const SetVerticalPolicy(QSizePolicy::Policy policy) SetHorizontalPolicy(QSizePolicy::Policy policy) SetControlType(QSizePolicy::ControlType type) QSizePolicy(QSizePolicy::Policy horizontal, QSizePolicy::Policy vertical, QSizePolicy::ControlType type = DefaultType)
0 Comments
Leave a Reply. |