~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to doc/html/qsizepolicy.html

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-08-24 04:09:09 UTC
  • Revision ID: james.westby@ubuntu.com-20050824040909-xmxe9jfr4a0w5671
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="iso-8859-1"?>
 
2
<!DOCTYPE html
 
3
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
 
4
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 
5
<!-- /tmp/qt-4.0.0-espenr-1119621036935/qt-x11-opensource-desktop-4.0.0/doc/src/qsizepolicy.qdoc -->
 
6
<head>
 
7
    <title>Qt 4.0: QSizePolicy Class Reference</title>
 
8
    <style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
 
9
a:link { color: #004faf; text-decoration: none }
 
10
a:visited { color: #672967; text-decoration: none }
 
11
td.postheader { font-family: sans-serif }
 
12
tr.address { font-family: sans-serif }
 
13
body { background: #ffffff; color: black; }</style>
 
14
</head>
 
15
<body>
 
16
<table border="0" cellpadding="0" cellspacing="0" width="100%">
 
17
<tr>
 
18
<td align="left" valign="top" width="32"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></td>
 
19
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="annotated.html"><font color="#004faf">Annotated</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
 
20
<td align="right" valign="top" width="230"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></td></tr></table><h1 align="center">QSizePolicy Class Reference</h1>
 
21
<p>The QSizePolicy class is a layout attribute describing horizontal and vertical resizing policy. <a href="#details">More...</a></p>
 
22
<pre>#include &lt;QSizePolicy&gt;</pre><p>Part of the <a href="qtgui.html">QtGui</a> module.</p>
 
23
<ul>
 
24
<li><a href="qsizepolicy-members.html">List of all members, including inherited members</a></li>
 
25
<li><a href="qsizepolicy-qt3.html">Qt 3 support members</a></li>
 
26
</ul>
 
27
<a name="public-types"></a>
 
28
<h3>Public Types</h3>
 
29
<ul>
 
30
<li><div class="fn"/>enum <b><a href="qsizepolicy.html#Policy-enum">Policy</a></b> { Fixed, Minimum, Maximum, Preferred, ..., Ignored }</li>
 
31
<li><div class="fn"/>enum <b><a href="qsizepolicy.html#PolicyFlag-enum">PolicyFlag</a></b> { GrowFlag, ExpandFlag, ShrinkFlag, IgnoreFlag }</li>
 
32
</ul>
 
33
<a name="public-functions"></a>
 
34
<h3>Public Functions</h3>
 
35
<ul>
 
36
<li><div class="fn"/><b><a href="qsizepolicy.html#QSizePolicy">QSizePolicy</a></b> ()</li>
 
37
<li><div class="fn"/><b><a href="qsizepolicy.html#QSizePolicy-2">QSizePolicy</a></b> ( Policy <i>horizontal</i>, Policy <i>vertical</i> )</li>
 
38
<li><div class="fn"/>Qt::Orientations <b><a href="qsizepolicy.html#expandingDirections">expandingDirections</a></b> () const</li>
 
39
<li><div class="fn"/>bool <b><a href="qsizepolicy.html#hasHeightForWidth">hasHeightForWidth</a></b> () const</li>
 
40
<li><div class="fn"/>Policy <b><a href="qsizepolicy.html#horizontalPolicy">horizontalPolicy</a></b> () const</li>
 
41
<li><div class="fn"/>int <b><a href="qsizepolicy.html#horizontalStretch">horizontalStretch</a></b> () const</li>
 
42
<li><div class="fn"/>void <b><a href="qsizepolicy.html#setHeightForWidth">setHeightForWidth</a></b> ( bool <i>hfw</i> )</li>
 
43
<li><div class="fn"/>void <b><a href="qsizepolicy.html#setHorizontalPolicy">setHorizontalPolicy</a></b> ( Policy <i>policy</i> )</li>
 
44
<li><div class="fn"/>void <b><a href="qsizepolicy.html#setHorizontalStretch">setHorizontalStretch</a></b> ( uchar <i>stretch</i> )</li>
 
45
<li><div class="fn"/>void <b><a href="qsizepolicy.html#setVerticalPolicy">setVerticalPolicy</a></b> ( Policy <i>policy</i> )</li>
 
46
<li><div class="fn"/>void <b><a href="qsizepolicy.html#setVerticalStretch">setVerticalStretch</a></b> ( uchar <i>stretch</i> )</li>
 
47
<li><div class="fn"/>void <b><a href="qsizepolicy.html#transpose">transpose</a></b> ()</li>
 
48
<li><div class="fn"/>Policy <b><a href="qsizepolicy.html#verticalPolicy">verticalPolicy</a></b> () const</li>
 
49
<li><div class="fn"/>int <b><a href="qsizepolicy.html#verticalStretch">verticalStretch</a></b> () const</li>
 
50
<li><div class="fn"/><b><a href="qsizepolicy.html#operator-QVariant">operator QVariant</a></b> () const</li>
 
51
<li><div class="fn"/>bool <b><a href="qsizepolicy.html#operator-not-eq">operator!=</a></b> ( const QSizePolicy &amp; <i>other</i> ) const</li>
 
52
<li><div class="fn"/>bool <b><a href="qsizepolicy.html#operator-eq-eq">operator==</a></b> ( const QSizePolicy &amp; <i>other</i> ) const</li>
 
53
</ul>
 
54
<a name="details"></a>
 
55
<hr />
 
56
<h2>Detailed Description</h2>
 
57
<p>The QSizePolicy class is a layout attribute describing horizontal and vertical resizing policy.</p>
 
58
<p>The size policy of a widget is an expression of its willingness to be resized in various ways.</p>
 
59
<p>Widgets that reimplement <a href="qwidget.html#sizePolicy-prop">QWidget::sizePolicy</a>() return a QSizePolicy that describes the horizontal and vertical resizing policy they prefer when being laid out.</p>
 
60
<p>QSizePolicy contains two independent <a href="qsizepolicy.html#Policy-enum">QSizePolicy::Policy</a> values and two stretch factors; 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.</p>
 
61
<p>The horizontal and vertical policies are set in the usual constructor and can be queried using <a href="qsizepolicy.html#horizontalPolicy">horizontalPolicy</a>() and <a href="qsizepolicy.html#verticalPolicy">verticalPolicy</a>().</p>
 
62
<p>The <a href="qsizepolicy.html#hasHeightForWidth">hasHeightForWidth</a>() flag indicates whether the widget's <a href="qwidget.html#sizeHint-prop">sizeHint()</a> is width-dependent (such as a menu bar or a word-wrapping label).</p>
 
63
<p>See also <a href="qsize.html">QSize</a>, <a href="qwidget.html#sizeHint-prop">QWidget::sizeHint</a>(), <a href="qwidget.html#sizePolicy-prop">QWidget::sizePolicy</a>(), and <a href="qlayoutitem.html#sizeHint">QLayoutItem::sizeHint</a>().</p>
 
64
<hr />
 
65
<h2>Member Type Documentation</h2>
 
66
<h3 class="fn"><a name="Policy-enum"></a>enum QSizePolicy::Policy</h3>
 
67
<p>The per-dimension sizing types used when constructing a <a href="qsizepolicy.html">QSizePolicy</a> are:</p>
 
68
<table border="1" cellpadding="2" cellspacing="1" width="100%">
 
69
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
 
70
<tr><td valign="top"><tt>QSizePolicy::Fixed</tt></td><td align="center" valign="top"><tt>0</tt></td><td valign="top">The <a href="qwidget.html#sizeHint-prop">QWidget::sizeHint</a>() is the only acceptable alternative, so the widget can never grow or shrink (e.g. the vertical direction of a push button).</td></tr>
 
71
<tr><td valign="top"><tt>QSizePolicy::Minimum</tt></td><td align="center" valign="top"><tt>GrowFlag</tt></td><td valign="top">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).</td></tr>
 
72
<tr><td valign="top"><tt>QSizePolicy::Maximum</tt></td><td align="center" valign="top"><tt>ShrinkFlag</tt></td><td valign="top">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).</td></tr>
 
73
<tr><td valign="top"><tt>QSizePolicy::Preferred</tt></td><td align="center" valign="top"><tt>GrowFlag | ShrinkFlag</tt></td><td valign="top">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 <a href="qwidget.html">QWidget</a> policy).</td></tr>
 
74
<tr><td valign="top"><tt>QSizePolicy::Expanding</tt></td><td align="center" valign="top"><tt>GrowFlag | ShrinkFlag | ExpandFlag</tt></td><td valign="top">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).</td></tr>
 
75
<tr><td valign="top"><tt>QSizePolicy::MinimumExpanding</tt></td><td align="center" valign="top"><tt>GrowFlag | ExpandFlag</tt></td><td valign="top">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).</td></tr>
 
76
<tr><td valign="top"><tt>QSizePolicy::Ignored</tt></td><td align="center" valign="top"><tt>ShrinkFlag | GrowFlag | IgnoreFlag</tt></td><td valign="top">The sizeHint() is ignored. The widget will get as much space as possible.</td></tr>
 
77
</table>
 
78
<p>See also <a href="qsizepolicy.html#PolicyFlag-enum">PolicyFlag</a>.</p>
 
79
<h3 class="fn"><a name="PolicyFlag-enum"></a>enum QSizePolicy::PolicyFlag</h3>
 
80
<p>These flags are combined together to form the various <a href="qsizepolicy.html#Policy-enum">Policy</a> values:</p>
 
81
<table border="1" cellpadding="2" cellspacing="1" width="100%">
 
82
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
 
83
<tr><td valign="top"><tt>QSizePolicy::GrowFlag</tt></td><td align="center" valign="top"><tt>1</tt></td><td valign="top">The widget can grow beyond its size hint if necessary.</td></tr>
 
84
<tr><td valign="top"><tt>QSizePolicy::ExpandFlag</tt></td><td align="center" valign="top"><tt>2</tt></td><td valign="top">The widget should get as much space as possible.</td></tr>
 
85
<tr><td valign="top"><tt>QSizePolicy::ShrinkFlag</tt></td><td align="center" valign="top"><tt>4</tt></td><td valign="top">The widget can shrink below its size hint if necessary.</td></tr>
 
86
<tr><td valign="top"><tt>QSizePolicy::IgnoreFlag</tt></td><td align="center" valign="top"><tt>8</tt></td><td valign="top">The widget's size hint is ignored. The widget will get as much space as possible.</td></tr>
 
87
</table>
 
88
<p>See also <a href="qsizepolicy.html#Policy-enum">Policy</a>.</p>
 
89
<hr />
 
90
<h2>Member Function Documentation</h2>
 
91
<h3 class="fn"><a name="QSizePolicy"></a>QSizePolicy::QSizePolicy ()</h3>
 
92
<p>Constructs a <a href="qsizepolicy.html">QSizePolicy</a> with <a href="qsizepolicy.html#Policy-enum">Fixed</a> as its horizontal and vertical policies.</p>
 
93
<p>See also <a href="qsizepolicy.html#setHorizontalPolicy">setHorizontalPolicy</a>(), <a href="qsizepolicy.html#setVerticalPolicy">setVerticalPolicy</a>(), <a href="qsizepolicy.html#setHorizontalStretch">setHorizontalStretch</a>(), <a href="qsizepolicy.html#setVerticalStretch">setVerticalStretch</a>(), and <a href="qsizepolicy.html#setHeightForWidth">setHeightForWidth</a>().</p>
 
94
<h3 class="fn"><a name="QSizePolicy-2"></a>QSizePolicy::QSizePolicy ( <a href="qsizepolicy.html#Policy-enum">Policy</a> <i>horizontal</i>, <a href="qsizepolicy.html#Policy-enum">Policy</a> <i>vertical</i> )</h3>
 
95
<p>It constructs a <a href="qsizepolicy.html">QSizePolicy</a> with independent horizontal and vertical policies, <i>horizontal</i> and <i>vertical</i> respectively. These policies affect how the widget is treated by the <a href="geomanagement.html">layout engine</a>.</p>
 
96
<p>Use <a href="qsizepolicy.html#setHeightForWidth">setHeightForWidth</a>() if the preferred height of the widget is dependent on the width of the widget (for example, a <a href="qlabel.html">QLabel</a> with line wrapping).</p>
 
97
<p>See also <a href="qsizepolicy.html#horizontalPolicy">horizontalPolicy</a>(), <a href="qsizepolicy.html#verticalPolicy">verticalPolicy</a>(), and <a href="qsizepolicy.html#setHeightForWidth">setHeightForWidth</a>().</p>
 
98
<h3 class="fn"><a name="expandingDirections"></a><a href="qt.html#Orientation-enum">Qt::Orientations</a> QSizePolicy::expandingDirections () const</h3>
 
99
<p>Returns whether this widget can make use of more space than sizeHint(). A value of <a href="qt.html#Orientation-enum">Qt::Horizontal</a> or <a href="qt.html#Orientation-enum">Qt::Vertical</a> means that the widget wants to grow horizontally or vertically (i.e., the horizontal or vertical policy is <a href="qsizepolicy.html#Policy-enum">Expanding</a> or <a href="qsizepolicy.html#Policy-enum">MinimumExpanding</a>), whereas <a href="qt.html#Orientation-enum">Qt::Horizontal</a> | <a href="qt.html#Orientation-enum">Qt::Vertical</a> means that it wants to grow in both dimensions.</p>
 
100
<p>See also <a href="qsizepolicy.html#horizontalPolicy">horizontalPolicy</a>() and <a href="qsizepolicy.html#verticalPolicy">verticalPolicy</a>().</p>
 
101
<h3 class="fn"><a name="hasHeightForWidth"></a>bool QSizePolicy::hasHeightForWidth () const</h3>
 
102
<p>Returns true if the widget's preferred height depends on its width; otherwise returns false.</p>
 
103
<p>See also <a href="qsizepolicy.html#setHeightForWidth">setHeightForWidth</a>().</p>
 
104
<h3 class="fn"><a name="horizontalPolicy"></a><a href="qsizepolicy.html#Policy-enum">Policy</a> QSizePolicy::horizontalPolicy () const</h3>
 
105
<p>Returns the horizontal component of the size policy.</p>
 
106
<p>See also <a href="qsizepolicy.html#setHorizontalPolicy">setHorizontalPolicy</a>(), <a href="qsizepolicy.html#verticalPolicy">verticalPolicy</a>(), and <a href="qsizepolicy.html#horizontalStretch">horizontalStretch</a>().</p>
 
107
<h3 class="fn"><a name="horizontalStretch"></a>int QSizePolicy::horizontalStretch () const</h3>
 
108
<p>Returns the horizontal stretch factor of the size policy.</p>
 
109
<p>See also <a href="qsizepolicy.html#setHorizontalStretch">setHorizontalStretch</a>() and <a href="qsizepolicy.html#verticalStretch">verticalStretch</a>().</p>
 
110
<h3 class="fn"><a name="setHeightForWidth"></a>void QSizePolicy::setHeightForWidth ( bool <i>hfw</i> )</h3>
 
111
<p>Sets the <a href="qsizepolicy.html#hasHeightForWidth">hasHeightForWidth</a>() flag to <i>hfw</i>.</p>
 
112
<p>See also <a href="qsizepolicy.html#hasHeightForWidth">hasHeightForWidth</a>().</p>
 
113
<h3 class="fn"><a name="setHorizontalPolicy"></a>void QSizePolicy::setHorizontalPolicy ( <a href="qsizepolicy.html#Policy-enum">Policy</a> <i>policy</i> )</h3>
 
114
<p>Sets the horizontal component of the size policy to <i>policy</i>.</p>
 
115
<p>See also <a href="qsizepolicy.html#horizontalPolicy">horizontalPolicy</a>() and <a href="qsizepolicy.html#setVerticalPolicy">setVerticalPolicy</a>().</p>
 
116
<h3 class="fn"><a name="setHorizontalStretch"></a>void QSizePolicy::setHorizontalStretch ( <a href="qtglobal.html#uchar-typedef">uchar</a> <i>stretch</i> )</h3>
 
117
<p>Sets the horizontal stretch factor of the size policy to <i>stretch</i>.</p>
 
118
<p>See also <a href="qsizepolicy.html#horizontalStretch">horizontalStretch</a>() and <a href="qsizepolicy.html#setVerticalStretch">setVerticalStretch</a>().</p>
 
119
<h3 class="fn"><a name="setVerticalPolicy"></a>void QSizePolicy::setVerticalPolicy ( <a href="qsizepolicy.html#Policy-enum">Policy</a> <i>policy</i> )</h3>
 
120
<p>Sets the vertical component of the size policy to <i>policy</i>.</p>
 
121
<p>See also <a href="qsizepolicy.html#verticalPolicy">verticalPolicy</a>() and <a href="qsizepolicy.html#setHorizontalPolicy">setHorizontalPolicy</a>().</p>
 
122
<h3 class="fn"><a name="setVerticalStretch"></a>void QSizePolicy::setVerticalStretch ( <a href="qtglobal.html#uchar-typedef">uchar</a> <i>stretch</i> )</h3>
 
123
<p>Sets the vertical stretch factor of the size policy to <i>stretch</i>.</p>
 
124
<p>See also <a href="qsizepolicy.html#verticalStretch">verticalStretch</a>() and <a href="qsizepolicy.html#setHorizontalStretch">setHorizontalStretch</a>().</p>
 
125
<h3 class="fn"><a name="transpose"></a>void QSizePolicy::transpose ()</h3>
 
126
<p>Swaps the horizontal and vertical policies and stretches.</p>
 
127
<h3 class="fn"><a name="verticalPolicy"></a><a href="qsizepolicy.html#Policy-enum">Policy</a> QSizePolicy::verticalPolicy () const</h3>
 
128
<p>Returns the vertical component of the size policy.</p>
 
129
<p>See also <a href="qsizepolicy.html#setVerticalPolicy">setVerticalPolicy</a>(), <a href="qsizepolicy.html#horizontalPolicy">horizontalPolicy</a>(), and <a href="qsizepolicy.html#verticalStretch">verticalStretch</a>().</p>
 
130
<h3 class="fn"><a name="verticalStretch"></a>int QSizePolicy::verticalStretch () const</h3>
 
131
<p>Returns the vertical stretch factor of the size policy.</p>
 
132
<p>See also <a href="qsizepolicy.html#setVerticalStretch">setVerticalStretch</a>() and <a href="qsizepolicy.html#horizontalStretch">horizontalStretch</a>().</p>
 
133
<h3 class="fn"><a name="operator-QVariant"></a>QSizePolicy::operator QVariant () const</h3>
 
134
<p>Returns a <a href="qvariant.html">QVariant</a> storing this <a href="qsizepolicy.html">QSizePolicy</a>.</p>
 
135
<h3 class="fn"><a name="operator-not-eq"></a>bool QSizePolicy::operator!= ( const QSizePolicy &amp; <i>other</i> ) const</h3>
 
136
<p>Returns true if this policy is different from <i>other</i>; otherwise returns false.</p>
 
137
<p>See also <a href="qsizepolicy.html#operator-eq-eq">operator==</a>().</p>
 
138
<h3 class="fn"><a name="operator-eq-eq"></a>bool QSizePolicy::operator== ( const QSizePolicy &amp; <i>other</i> ) const</h3>
 
139
<p>Returns true if this policy is equal to <i>other</i>; otherwise returns false.</p>
 
140
<p>See also <a href="qsizepolicy.html#operator-not-eq">operator!=</a>().</p>
 
141
<p /><address><hr /><div align="center">
 
142
<table width="100%" cellspacing="0" border="0"><tr class="address">
 
143
<td width="30%">Copyright &copy; 2005 <a href="trolltech.html">Trolltech</a></td>
 
144
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
 
145
<td width="30%" align="right"><div align="right">Qt 4.0.0</div></td>
 
146
</tr></table></div></address></body>
 
147
</html>