Eneboo - Documentación para desarrolladores
|
The QSizePolicy class is a layout attribute describing horizontal and vertical resizing policy. Más...
#include <qsizepolicy.h>
Tipos públicos | |
enum | SizeType { Fixed = 0, Minimum = MayGrow, Maximum = MayShrink, Preferred = MayGrow | MayShrink, MinimumExpanding = MayGrow | ExpMask, Expanding = MayGrow | MayShrink | ExpMask, Ignored = ExpMask, Fixed = 0, Minimum = MayGrow, Maximum = MayShrink, Preferred = MayGrow | MayShrink, MinimumExpanding = MayGrow | ExpMask, Expanding = MayGrow | MayShrink | ExpMask, Ignored = ExpMask } |
enum | ExpandData { NoDirection = 0, Horizontally = 1, Vertically = 2, Horizontal = Horizontally, Vertical = Vertically, BothDirections = Horizontally | Vertically, NoDirection = 0, Horizontally = 1, Vertically = 2, Horizontal = Horizontally, Vertical = Vertically, BothDirections = Horizontally | Vertically } |
enum | SizeType { Fixed = 0, Minimum = MayGrow, Maximum = MayShrink, Preferred = MayGrow | MayShrink, MinimumExpanding = MayGrow | ExpMask, Expanding = MayGrow | MayShrink | ExpMask, Ignored = ExpMask, Fixed = 0, Minimum = MayGrow, Maximum = MayShrink, Preferred = MayGrow | MayShrink, MinimumExpanding = MayGrow | ExpMask, Expanding = MayGrow | MayShrink | ExpMask, Ignored = ExpMask } |
enum | ExpandData { NoDirection = 0, Horizontally = 1, Vertically = 2, Horizontal = Horizontally, Vertical = Vertically, BothDirections = Horizontally | Vertically, NoDirection = 0, Horizontally = 1, Vertically = 2, Horizontal = Horizontally, Vertical = Vertically, BothDirections = Horizontally | Vertically } |
Métodos públicos | |
QSizePolicy () | |
QSizePolicy (SizeType hor, SizeType ver, bool hfw=FALSE) | |
QSizePolicy (SizeType hor, SizeType ver, uchar hors, uchar vers, bool hfw=FALSE) | |
SizeType | horData () const |
SizeType | verData () const |
bool | mayShrinkHorizontally () const |
bool | mayShrinkVertically () const |
bool | mayGrowHorizontally () const |
bool | mayGrowVertically () const |
ExpandData | expanding () const |
void | setHorData (SizeType d) |
void | setVerData (SizeType d) |
void | setHeightForWidth (bool b) |
bool | hasHeightForWidth () const |
bool | operator== (const QSizePolicy &s) const |
bool | operator!= (const QSizePolicy &s) const |
uint | horStretch () const |
uint | verStretch () const |
void | setHorStretch (uchar sf) |
void | setVerStretch (uchar sf) |
void | transpose () |
QSizePolicy () | |
QSizePolicy (SizeType hor, SizeType ver, bool hfw=FALSE) | |
QSizePolicy (SizeType hor, SizeType ver, uchar hors, uchar vers, bool hfw=FALSE) | |
SizeType | horData () const |
SizeType | verData () const |
bool | mayShrinkHorizontally () const |
bool | mayShrinkVertically () const |
bool | mayGrowHorizontally () const |
bool | mayGrowVertically () const |
ExpandData | expanding () const |
void | setHorData (SizeType d) |
void | setVerData (SizeType d) |
void | setHeightForWidth (bool b) |
bool | hasHeightForWidth () const |
bool | operator== (const QSizePolicy &s) const |
bool | operator!= (const QSizePolicy &s) const |
uint | horStretch () const |
uint | verStretch () const |
void | setHorStretch (uchar sf) |
void | setVerStretch (uchar sf) |
void | transpose () |
The QSizePolicy class is a layout attribute describing horizontal and vertical resizing policy.
The size policy of a widget is an expression of its willingness to be resized in various ways.
Widgets that reimplement QWidget::sizePolicy() return a QSizePolicy that describes the horizontal and vertical resizing policy they prefer when being laid out. Only one of the constructors is of interest in most applications.
QSizePolicy contains two independent SizeType objects; one describes the widgets's horizontal size policy, and the other describes its vertical size policy. It also contains a flag to indicate whether the height and width of its preferred size are related.
The horizontal and vertical {SizeType}s are set in the usual constructor and can be queried using a variety of functions.
The hasHeightForWidth() flag indicates whether the widget's sizeHint() is width-dependent (such as a word-wrapping label) or not.
This enum type describes in which directions a widget can make use of extra space. There are four possible values:
NoDirection the widget cannot make use of extra space in any direction.
Horizontally the widget can usefully be wider than the sizeHint().
Vertically the widget can usefully be taller than the sizeHint().
BothDirections the widget can usefully be both wider and taller than the sizeHint().
The per-dimension sizing types used when constructing a QSizePolicy are:
Fixed 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).
Minimum 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().
Maximum 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().
Preferred 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).
Expanding 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).
MinimumExpanding 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).
Ignored the sizeHint() is ignored. The widget will get as much space as possible.
QSizePolicy::QSizePolicy | ( | ) | [inline] |
Constructs a minimally initialized QSizePolicy.
interesting This is the constructor normally used to return a value in the overridden QWidget::sizePolicy() function of a QWidget subclass.
It constructs a QSizePolicy with independent horizontal and vertical sizing types, hor and ver respectively. These sizing types affect how the widget is treated by the layout engine.
If hfw is TRUE, the preferred height of the widget is dependent on the width of the widget (for example, a QLabel with line wrapping).
QSizePolicy::QSizePolicy | ( | SizeType | hor, |
SizeType | ver, | ||
uchar | horStretch, | ||
uchar | verStretch, | ||
bool | hfw = FALSE |
||
) | [inline] |
Constructs a QSizePolicy with independent horizontal and vertical sizing types hor and ver, and stretch factors horStretch and verStretch.
If hfw is TRUE, the preferred height of the widget is dependent on the width of the widget.
QSizePolicy::QSizePolicy | ( | ) | [inline] |
QSizePolicy::ExpandData QSizePolicy::expanding | ( | ) | const [inline] |
Returns whether this layout can make use of more space than sizeHint(). A value of Vertical
or Horizontal
means that it wants to grow in only one dimension, whereas BothDirections
means that it wants to grow in both dimensions.
ExpandData QSizePolicy::expanding | ( | ) | const [inline] |
bool QSizePolicy::hasHeightForWidth | ( | ) | const [inline] |
Returns TRUE if the widget's preferred height depends on its width; otherwise returns FALSE.
bool QSizePolicy::hasHeightForWidth | ( | ) | const [inline] |
SizeType QSizePolicy::horData | ( | ) | const [inline] |
QSizePolicy::SizeType QSizePolicy::horData | ( | ) | const [inline] |
Returns the horizontal component of the size policy.
uint QSizePolicy::horStretch | ( | ) | const [inline] |
uint QSizePolicy::horStretch | ( | ) | const [inline] |
Returns the horizontal stretch factor of the size policy.
bool QSizePolicy::mayGrowHorizontally | ( | ) | const [inline] |
Returns TRUE if the widget can sensibly be wider than its sizeHint(); otherwise returns FALSE.
bool QSizePolicy::mayGrowHorizontally | ( | ) | const [inline] |
bool QSizePolicy::mayGrowVertically | ( | ) | const [inline] |
bool QSizePolicy::mayGrowVertically | ( | ) | const [inline] |
Returns TRUE if the widget can sensibly be taller than its sizeHint(); otherwise returns FALSE.
bool QSizePolicy::mayShrinkHorizontally | ( | ) | const [inline] |
bool QSizePolicy::mayShrinkHorizontally | ( | ) | const [inline] |
Returns TRUE if the widget can sensibly be narrower than its sizeHint(); otherwise returns FALSE.
bool QSizePolicy::mayShrinkVertically | ( | ) | const [inline] |
bool QSizePolicy::mayShrinkVertically | ( | ) | const [inline] |
Returns TRUE if the widget can sensibly be shorter than its sizeHint(); otherwise returns FALSE.
bool QSizePolicy::operator!= | ( | const QSizePolicy & | s | ) | const [inline] |
Returns TRUE if this policy is different from s; otherwise returns FALSE.
bool QSizePolicy::operator!= | ( | const QSizePolicy & | s | ) | const [inline] |
bool QSizePolicy::operator== | ( | const QSizePolicy & | s | ) | const [inline] |
bool QSizePolicy::operator== | ( | const QSizePolicy & | s | ) | const [inline] |
Returns TRUE if this policy is equal to s; otherwise returns FALSE.
void QSizePolicy::setHeightForWidth | ( | bool | b | ) | [inline] |
Sets the hasHeightForWidth() flag to b.
void QSizePolicy::setHeightForWidth | ( | bool | b | ) | [inline] |
void QSizePolicy::setHorData | ( | SizeType | d | ) | [inline] |
Sets the horizontal component of the size policy to size type d.
void QSizePolicy::setHorData | ( | SizeType | d | ) | [inline] |
void QSizePolicy::setHorStretch | ( | uchar | sf | ) | [inline] |
void QSizePolicy::setHorStretch | ( | uchar | sf | ) | [inline] |
Sets the horizontal stretch factor of the size policy to sf.
void QSizePolicy::setVerData | ( | SizeType | d | ) | [inline] |
Sets the vertical component of the size policy to size type d.
void QSizePolicy::setVerData | ( | SizeType | d | ) | [inline] |
void QSizePolicy::setVerStretch | ( | uchar | sf | ) | [inline] |
Sets the vertical stretch factor of the size policy to sf.
void QSizePolicy::setVerStretch | ( | uchar | sf | ) | [inline] |
void QSizePolicy::transpose | ( | ) | [inline] |
Swaps the horizontal and vertical policies and stretches.
void QSizePolicy::transpose | ( | ) | [inline] |
SizeType QSizePolicy::verData | ( | ) | const [inline] |
QSizePolicy::SizeType QSizePolicy::verData | ( | ) | const [inline] |
Returns the vertical component of the size policy.
uint QSizePolicy::verStretch | ( | ) | const [inline] |
uint QSizePolicy::verStretch | ( | ) | const [inline] |
Returns the vertical stretch factor of the size policy.