QSizePolicy Class Reference |
Constant | Value | Description |
---|---|---|
QSizePolicy::Fixed | 0 | The QWidget::sizeHint() is the only acceptable alternative, so the widget can never grow or shrink (e.g. the vertical direction of a push button). |
QSizePolicy::Minimum | GrowFlag | The sizeHint() is minimal, and sufficient. The widget can be expanded, but there is no advantage to it being larger (e.g. the horizontal direction of a push button). It cannot be smaller than the size provided by sizeHint(). |
QSizePolicy::Maximum | ShrinkFlag | The sizeHint() is a maximum. The widget can be shrunk any amount without detriment if other widgets need the space (e.g. a separator line). It cannot be larger than the size provided by sizeHint(). |
QSizePolicy::Preferred | GrowFlag | ShrinkFlag | The sizeHint() is best, 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). |
QSizePolicy::Expanding | GrowFlag | ShrinkFlag | ExpandFlag | The sizeHint() is a sensible size, but the widget can be shrunk and still be useful. The widget can make use of extra space, so it should get as much space as possible (e.g. the horizontal direction of a slider). |
QSizePolicy::MinimumExpanding | GrowFlag | ExpandFlag | The sizeHint() is minimal, and sufficient. The widget can make use of extra space, so it should get as much space as possible (e.g. the horizontal direction of a slider). |
QSizePolicy::Ignored | ShrinkFlag | GrowFlag | IgnoreFlag | The sizeHint() is ignored. The widget will get as much space as possible. |
See also PolicyFlag, setHorizontalPolicy(), and setVerticalPolicy().
These flags are combined together to form the various Policy values:
Constant | Value | Description |
---|---|---|
QSizePolicy::GrowFlag | 1 | The widget can grow beyond its size hint if necessary. |
QSizePolicy::ExpandFlag | 2 | The widget should get as much space as possible. |
QSizePolicy::ShrinkFlag | 4 | The widget can shrink below its size hint if necessary. |
QSizePolicy::IgnoreFlag | 8 | The widget's size hint is ignored. The widget will get as much space as possible. |
See also Policy.
Constructs a QSizePolicy object with Fixed as its horizontal and vertical policies.
The policies can be altered using the setHorizontalPolicy() and setVerticalPolicy() functions. Use the setHeightForWidth() function if the preferred height of the widget is dependent on the width of the widget (for example, a QLabel with line wrapping).
See also setHorizontalStretch() and setVerticalStretch().
Constructs a QSizePolicy object with the given horizontal and vertical policies.
Use setHeightForWidth() if the preferred height of the widget is dependent on the width of the widget (for example, a QLabel with line wrapping).
See also setHorizontalStretch() and setVerticalStretch().
Returns whether a widget can make use of more space than the QWidget::sizeHint() function indicates.
A value of Qt::Horizontal or Qt::Vertical means that the widget can grow horizontally or vertically (i.e., the horizontal or vertical policy is Expanding or MinimumExpanding), whereas Qt::Horizontal | Qt::Vertical means that it can grow in both dimensions.
See also horizontalPolicy() and verticalPolicy().
Returns true if the widget's preferred height depends on its width; otherwise returns false.
See also setHeightForWidth().
Returns the horizontal component of the size policy.
See also setHorizontalPolicy(), verticalPolicy(), and horizontalStretch().
Returns the horizontal stretch factor of the size policy.
See also setHorizontalStretch(), verticalStretch(), and horizontalPolicy().
Sets the flag determining whether the widget's preferred height depends on its width, to dependent.
See also hasHeightForWidth().
Sets the horizontal component to the given policy.
See also horizontalPolicy(), setVerticalPolicy(), and setHorizontalStretch().
Sets the horizontal stretch factor of the size policy to the given stretchFactor.
See also horizontalStretch(), setVerticalStretch(), and setHorizontalPolicy().
Sets the vertical component to the given policy.
See also verticalPolicy(), setHorizontalPolicy(), and setVerticalStretch().
Sets the vertical stretch factor of the size policy to the given stretchFactor.
See also verticalStretch(), setHorizontalStretch(), and setVerticalPolicy().
Swaps the horizontal and vertical policies and stretches.
Returns the vertical component of the size policy.
See also setVerticalPolicy(), horizontalPolicy(), and verticalStretch().
Returns the vertical stretch factor of the size policy.
See also setVerticalStretch(), horizontalStretch(), and verticalPolicy().
Returns a QVariant storing this QSizePolicy.
Returns true if this policy is different from other; otherwise returns false.
See also operator==().
Returns true if this policy is equal to other; otherwise returns false.
See also operator!=().
This is an overloaded member function, provided for convenience.
Writes the size policy to the data stream stream.
This function was introduced in Qt 4.2.
See also Format of the QDataStream operators.
This is an overloaded member function, provided for convenience.
Reads the size policy from the data stream stream.
This function was introduced in Qt 4.2.
See also Format of the QDataStream operators.
Use the Qt::Orientations enum instead.
Constant | Value | Description |
---|---|---|
QSizePolicy::NoDirection | 0x0 | Use 0 instead. |
QSizePolicy::Horizontally | 0x1 | Use Qt::Horizontal instead. |
QSizePolicy::Vertically | 0x2 | Use Qt::Vertical instead. |
QSizePolicy::BothDirections | 0x3 | Use Qt::Horizontal | Qt::Vertical instead. |
Use the QSizePolicy::Policy enum instead.
Use the QSizePolicy() constructor and the setHeightForWidth() function instead.
For example, if you have code like
QSizePolicy *policy = new QSizePolicy(horizontal, vertical, dependent);
you can rewrite it as
QSizePolicy *policy = new QSizePolicy(horizontal, vertical); policy->setHeightForWidth(dependent);
Use the QSizePolicy() constructor and call the setHorizontalStretch(), setVerticalStretch(), and setHeightForWidth() functions instead.
For example, if you have code like
QSizePolicy *policy = new QSizePolicy(horizontal, vertical, horizontalStretch, verticalStretch, dependent);
you can rewrite it as
QSizePolicy *policy = new QSizePolicy(horizontal, vertical); policy->setHorizontalStretch(horizontalStretch); policy->setVerticalStretch(verticalStretch); policy->setHeightForWidth(dependent);
Use expandingDirections() instead.
Use horizontalPolicy() instead.
See also setHorData().
Use horizontalStretch() instead.
See also setHorStretch().
Use the horizontalPolicy() function combined with the QSizePolicy::PolicyFlag enum instead.
For example, if you have code like
bool policy = mayGrowHorizontally();
you can rewrite it as
bool policy = horizontalPolicy() & QSizePolicy::GrowFlag;
Use the verticalPolicy() function combined with the QSizePolicy::PolicyFlag enum instead.
For example, if you have code like
bool policy = mayGrowVertically();
you can rewrite it as
bool policy = verticalPolicy() & QSizePolicy::GrowFlag;
Use the horizontalPolicy() function combined with the QSizePolicy::PolicyFlag enum instead.
For example, if you have code like
bool policy = mayShrinkHorizontally();
you can rewrite it as
bool policy = horizontalPolicy() & QSizePolicy::ShrinkFlag;
Use the verticalPolicy() function combined with the QSizePolicy::PolicyFlag enum instead.
For example, if you have code like
bool policy = mayShrinkVertically();
you can rewrite it as
bool policy = verticalPolicy() & QSizePolicy::ShrinkFlag;
Use setHorizontalPolicy() instead.
See also horData().
Use setHorizontalStretch() instead.
See also horStretch().
Use setVerticalPolicy() instead.
See also verData().
Use setVerticalStretch() instead.
See also verStretch().
Use verticalPolicy() instead.
See also setVerData().
Use verticalStretch() instead.
See also setVerStretch().
Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. | Qt 4.2 | |
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD. | ||
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP ! |
Copyright © 2000-2012 - www.developpez.com