File: qstyleoption.html

package info (click to toggle)
python-qt4 4.12.1%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 40,300 kB
  • ctags: 6,185
  • sloc: python: 125,988; cpp: 13,291; xml: 292; makefile: 246; php: 27; sh: 2
file content (360 lines) | stat: -rw-r--r-- 23,833 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QStyleOption Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QStyleOption Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QStyleOption class stores the parameters used by <a href="qstyle.html">QStyle</a> functions. <a href="#details">More...</a></p>

<p>Inherited by <a href="qstyleoptionbutton.html">QStyleOptionButton</a>, <a href="qstyleoptioncomplex.html">QStyleOptionComplex</a>, <a href="qstyleoptiondockwidget.html">QStyleOptionDockWidget</a>, <a href="qstyleoptionfocusrect.html">QStyleOptionFocusRect</a>, <a href="qstyleoptionframe.html">QStyleOptionFrame</a>, <a href="qstyleoptiongraphicsitem.html">QStyleOptionGraphicsItem</a>, <a href="qstyleoptionheader.html">QStyleOptionHeader</a>, <a href="qstyleoptionmenuitem.html">QStyleOptionMenuItem</a>, <a href="qstyleoptionprogressbar.html">QStyleOptionProgressBar</a>, <a href="qstyleoptionrubberband.html">QStyleOptionRubberBand</a>, <a href="qstyleoptiontab.html">QStyleOptionTab</a>, <a href="qstyleoptiontabbarbase.html">QStyleOptionTabBarBase</a>, <a href="qstyleoptiontabwidgetframe.html">QStyleOptionTabWidgetFrame</a>, <a href="qstyleoptiontoolbar.html">QStyleOptionToolBar</a>, <a href="qstyleoptiontoolbox.html">QStyleOptionToolBox</a> and <a href="qstyleoptionviewitem.html">QStyleOptionViewItem</a>.</p><h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qstyleoption.html#OptionType-enum">OptionType</a></b> { SO_Default, SO_FocusRect, SO_Button, SO_Tab, ..., SO_CustomBase }</li><li><div class="fn" />enum <b><a href="qstyleoption.html#StyleOptionType-enum">StyleOptionType</a></b> { Type }</li><li><div class="fn" />enum <b><a href="qstyleoption.html#StyleOptionVersion-enum">StyleOptionVersion</a></b> { Version }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qstyleoption.html#QStyleOption">__init__</a></b> (<i>self</i>, int&#160;<i>version</i>&#160;=&#160;QStyleOption.Version, int&#160;<i>type</i>&#160;=&#160;QStyleOption.SO_Default)</li><li><div class="fn" /><b><a href="qstyleoption.html#QStyleOption-2">__init__</a></b> (<i>self</i>, QStyleOption&#160;<i>other</i>)</li><li><div class="fn" /><b><a href="qstyleoption.html#init">init</a></b> (<i>self</i>, QWidget&#160;<i>w</i>)</li><li><div class="fn" /><b><a href="qstyleoption.html#initFrom">initFrom</a></b> (<i>self</i>, QWidget&#160;<i>w</i>)</li></ul><h3>Members</h3><ul><li><div class="fn" />Qt.LayoutDirection <b><a href="qstyleoption.html#direction-var">direction</a></b></li><li><div class="fn" />QFontMetrics <b><a href="qstyleoption.html#fontMetrics-var">fontMetrics</a></b></li><li><div class="fn" />QPalette <b><a href="qstyleoption.html#palette-var">palette</a></b></li><li><div class="fn" />QRect <b><a href="qstyleoption.html#rect-var">rect</a></b></li><li><div class="fn" />QStyle.State <b><a href="qstyleoption.html#state-var">state</a></b></li><li><div class="fn" />int <b><a href="qstyleoption.html#type-var">type</a></b></li><li><div class="fn" />int <b><a href="qstyleoption.html#version-var">version</a></b></li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QStyleOption class stores the parameters used by <a href="qstyle.html">QStyle</a> functions.</p>
<p>QStyleOption and its subclasses contain all the information that
<a href="qstyle.html">QStyle</a> functions need to draw a graphical
element.</p>
<p>For performance reasons, there are few member functions and the
access to the member variables is direct (i.e., using the
<tt>.</tt> or <tt>-&gt;</tt> operator). This low-level feel makes
the structures straightforward to use and emphasizes that these are
simply parameters used by the style functions.</p>
<p>The caller of a <a href="qstyle.html">QStyle</a> function
usually creates QStyleOption objects on the stack. This combined
with Qt's extensive use of <a href="implicit-sharing.html">implicit
sharing</a> for types such as <a href="qstring.html">QString</a>,
<a href="qpalette.html">QPalette</a>, and <a href="qcolor.html">QColor</a> ensures that no memory allocation
needlessly takes place.</p>
<p>The following code snippet shows how to use a specific
QStyleOption subclass to paint a push button:</p>
<pre class="cpp">
 <span class="type">void</span> MyPushButton<span class="operator">.</span>paintEvent(<span class="type"><a href="qpaintevent.html">QPaintEvent</a></span> <span class="operator">*</span>)
 {
     <span class="type"><a href="qstyleoptionbutton.html">QStyleOptionButton</a></span> option;
     option<span class="operator">.</span>initFrom(<span class="keyword">this</span>);
     option<span class="operator">.</span>state <span class="operator">=</span> isDown() <span class="operator">?</span> <span class="type"><a href="qstyle.html">QStyle</a></span><span class="operator">.</span>State_Sunken : <span class="type"><a href="qstyle.html">QStyle</a></span><span class="operator">.</span>State_Raised;
     <span class="keyword">if</span> (isDefault())
         option<span class="operator">.</span>features <span class="operator">|</span><span class="operator">=</span> <span class="type"><a href="qstyleoptionbutton.html">QStyleOptionButton</a></span><span class="operator">.</span>DefaultButton;
     option<span class="operator">.</span>text <span class="operator">=</span> text();
     option<span class="operator">.</span>icon <span class="operator">=</span> icon();

     <span class="type"><a href="qpainter.html">QPainter</a></span> painter(<span class="keyword">this</span>);
     style()<span class="operator">-</span><span class="operator">&gt;</span>drawControl(<span class="type"><a href="qstyle.html">QStyle</a></span><span class="operator">.</span>CE_PushButton<span class="operator">,</span> <span class="operator">&amp;</span>option<span class="operator">,</span> <span class="operator">&amp;</span>painter<span class="operator">,</span> <span class="keyword">this</span>);
 }
</pre>
<p>In our example, the control is a <a href="qstyle.html#ControlElement-enum">QStyle.CE_PushButton</a>, and
according to the <a href="qstyle.html#drawControl">QStyle.drawControl</a>() documentation
the corresponding class is <a href="qstyleoptionbutton.html">QStyleOptionButton</a>.</p>
<p>When reimplementing <a href="qstyle.html">QStyle</a> functions
that take a QStyleOption parameter, you often need to cast the
QStyleOption to a subclass. For safety, you can use <a href="qstyleoption.html#qstyleoption_cast">qstyleoption_cast</a>() to
ensure that the pointer type is correct. For example:</p>
<pre class="cpp">
 <span class="type">void</span> MyStyle<span class="operator">.</span>drawPrimitive(PrimitiveElement element<span class="operator">,</span>
                             <span class="keyword">const</span> <span class="type">QStyleOption</span> <span class="operator">*</span>option<span class="operator">,</span>
                             <span class="type"><a href="qpainter.html">QPainter</a></span> <span class="operator">*</span>painter<span class="operator">,</span>
                             <span class="keyword">const</span> <span class="type"><a href="qwidget.html">QWidget</a></span> <span class="operator">*</span>widget)
 {
     <span class="keyword">if</span> (element <span class="operator">=</span><span class="operator">=</span> PE_FrameFocusRect) {
         <span class="keyword">const</span> <span class="type"><a href="qstyleoptionfocusrect.html">QStyleOptionFocusRect</a></span> <span class="operator">*</span>focusRectOption <span class="operator">=</span>
                 qstyleoption_cast<span class="operator">&lt;</span><span class="keyword">const</span> <span class="type"><a href="qstyleoptionfocusrect.html">QStyleOptionFocusRect</a></span> <span class="operator">*</span><span class="operator">&gt;</span>(option);
         <span class="keyword">if</span> (focusRectOption) {
             <span class="comment">// ...</span>
         }
     }
     <span class="comment">// ...</span>
 }
</pre>
<p>The <a href="qstyleoption.html#qstyleoption_cast">qstyleoption_cast</a>()
function will return 0 if the object to which <tt>option</tt>
points is not of the correct type.</p>
<p>For an example demonstrating how style options can be used, see
the <a href="widgets-styles.html">Styles</a> example.</p>
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="OptionType-enum" />QStyleOption.OptionType</h3><p>This enum is used internally by <a href="qstyleoption.html">QStyleOption</a>, its subclasses, and <a href="qstyleoption.html#qstyleoption_cast">qstyleoption_cast</a>() to
determine the type of style option. In general you do not need to
worry about this unless you want to create your own <a href="qstyleoption.html">QStyleOption</a> subclass and your own
styles.</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QStyleOption.SO_Button</tt></td>
<td class="topAlign"><tt>2</tt></td>
<td class="topAlign"><a href="qstyleoptionbutton.html">QStyleOptionButton</a></td>
</tr>
<tr>
<td class="topAlign"><tt>QStyleOption.SO_ComboBox</tt></td>
<td class="topAlign">?</td>
<td class="topAlign"><a href="qstyleoptioncombobox.html">QStyleOptionComboBox</a></td>
</tr>
<tr>
<td class="topAlign"><tt>QStyleOption.SO_Complex</tt></td>
<td class="topAlign"><tt>0xf0000</tt></td>
<td class="topAlign"><a href="qstyleoptioncomplex.html">QStyleOptionComplex</a></td>
</tr>
<tr>
<td class="topAlign"><tt>QStyleOption.SO_Default</tt></td>
<td class="topAlign"><tt>0</tt></td>
<td class="topAlign"><a href="qstyleoption.html">QStyleOption</a></td>
</tr>
<tr>
<td class="topAlign"><tt>QStyleOption.SO_DockWidget</tt></td>
<td class="topAlign"><tt>10</tt></td>
<td class="topAlign"><a href="qstyleoptiondockwidget.html">QStyleOptionDockWidget</a></td>
</tr>
<tr>
<td class="topAlign"><tt>QStyleOption.SO_FocusRect</tt></td>
<td class="topAlign"><tt>1</tt></td>
<td class="topAlign"><a href="qstyleoptionfocusrect.html">QStyleOptionFocusRect</a></td>
</tr>
<tr>
<td class="topAlign"><tt>QStyleOption.SO_Frame</tt></td>
<td class="topAlign"><tt>5</tt></td>
<td class="topAlign"><a href="qstyleoptionframe.html">QStyleOptionFrame</a> <a href="qstyleoptionframev2.html">QStyleOptionFrameV2</a></td>
</tr>
<tr>
<td class="topAlign"><tt>QStyleOption.SO_GraphicsItem</tt></td>
<td class="topAlign"><tt>17</tt></td>
<td class="topAlign"><a href="qstyleoptiongraphicsitem.html">QStyleOptionGraphicsItem</a></td>
</tr>
<tr>
<td class="topAlign"><tt>QStyleOption.SO_GroupBox</tt></td>
<td class="topAlign">?</td>
<td class="topAlign"><a href="qstyleoptiongroupbox.html">QStyleOptionGroupBox</a></td>
</tr>
<tr>
<td class="topAlign"><tt>QStyleOption.SO_Header</tt></td>
<td class="topAlign"><tt>8</tt></td>
<td class="topAlign"><a href="qstyleoptionheader.html">QStyleOptionHeader</a></td>
</tr>
<tr>
<td class="topAlign"><tt>QStyleOption.SO_MenuItem</tt></td>
<td class="topAlign"><tt>4</tt></td>
<td class="topAlign"><a href="qstyleoptionmenuitem.html">QStyleOptionMenuItem</a></td>
</tr>
<tr>
<td class="topAlign"><tt>QStyleOption.SO_ProgressBar</tt></td>
<td class="topAlign"><tt>6</tt></td>
<td class="topAlign"><a href="qstyleoptionprogressbar.html">QStyleOptionProgressBar</a> <a href="qstyleoptionprogressbarv2.html">QStyleOptionProgressBarV2</a></td>
</tr>
<tr>
<td class="topAlign"><tt>QStyleOption.SO_RubberBand</tt></td>
<td class="topAlign"><tt>15</tt></td>
<td class="topAlign"><a href="qstyleoptionrubberband.html">QStyleOptionRubberBand</a></td>
</tr>
<tr>
<td class="topAlign"><tt>QStyleOption.SO_SizeGrip</tt></td>
<td class="topAlign">?</td>
<td class="topAlign"><a href="qstyleoptionsizegrip.html">QStyleOptionSizeGrip</a></td>
</tr>
<tr>
<td class="topAlign"><tt>QStyleOption.SO_Slider</tt></td>
<td class="topAlign">?</td>
<td class="topAlign"><a href="qstyleoptionslider.html">QStyleOptionSlider</a></td>
</tr>
<tr>
<td class="topAlign"><tt>QStyleOption.SO_SpinBox</tt></td>
<td class="topAlign">?</td>
<td class="topAlign"><a href="qstyleoptionspinbox.html">QStyleOptionSpinBox</a></td>
</tr>
<tr>
<td class="topAlign"><tt>QStyleOption.SO_Tab</tt></td>
<td class="topAlign"><tt>3</tt></td>
<td class="topAlign"><a href="qstyleoptiontab.html">QStyleOptionTab</a></td>
</tr>
<tr>
<td class="topAlign"><tt>QStyleOption.SO_TabBarBase</tt></td>
<td class="topAlign"><tt>14</tt></td>
<td class="topAlign"><a href="qstyleoptiontabbarbase.html">QStyleOptionTabBarBase</a></td>
</tr>
<tr>
<td class="topAlign"><tt>QStyleOption.SO_TabWidgetFrame</tt></td>
<td class="topAlign"><tt>13</tt></td>
<td class="topAlign"><a href="qstyleoptiontabwidgetframe.html">QStyleOptionTabWidgetFrame</a></td>
</tr>
<tr>
<td class="topAlign"><tt>QStyleOption.SO_TitleBar</tt></td>
<td class="topAlign">?</td>
<td class="topAlign"><a href="qstyleoptiontitlebar.html">QStyleOptionTitleBar</a></td>
</tr>
<tr>
<td class="topAlign"><tt>QStyleOption.SO_ToolBar</tt></td>
<td class="topAlign"><tt>16</tt></td>
<td class="topAlign"><a href="qstyleoptiontoolbar.html">QStyleOptionToolBar</a></td>
</tr>
<tr>
<td class="topAlign"><tt>QStyleOption.SO_ToolBox</tt></td>
<td class="topAlign"><tt>7</tt></td>
<td class="topAlign"><a href="qstyleoptiontoolbox.html">QStyleOptionToolBox</a></td>
</tr>
<tr>
<td class="topAlign"><tt>QStyleOption.SO_ToolButton</tt></td>
<td class="topAlign">?</td>
<td class="topAlign"><a href="qstyleoptiontoolbutton.html">QStyleOptionToolButton</a></td>
</tr>
<tr>
<td class="topAlign"><tt>QStyleOption.SO_ViewItem</tt></td>
<td class="topAlign"><tt>12</tt></td>
<td class="topAlign"><a href="qstyleoptionviewitem.html">QStyleOptionViewItem</a> (used in
Interviews)</td>
</tr>
</table>
<p>The following values are used for custom controls:</p>
<table class="valuelist">
<tr class="even" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QStyleOption.SO_CustomBase</tt></td>
<td class="topAlign"><tt>0xf00</tt></td>
<td class="topAlign">Reserved for custom QStyleOptions; all custom
controls values must be above this value</td>
</tr>
<tr>
<td class="topAlign">
<tt>QStyleOption.SO_ComplexCustomBase</tt></td>
<td class="topAlign"><tt>0xf000000</tt></td>
<td class="topAlign">Reserved for custom QStyleOptions; all custom
complex controls values must be above this value</td>
</tr>
</table>
<p>Some style options are defined for various <a href="qt3support.html">Qt3Support</a> controls:</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QStyleOption.SO_Q3DockWindow</tt></td>
<td class="topAlign"><tt>9</tt></td>
<td class="topAlign"><a href="qstyleoptionq3dockwindow.html">QStyleOptionQ3DockWindow</a></td>
</tr>
<tr>
<td class="topAlign"><tt>QStyleOption.SO_Q3ListView</tt></td>
<td class="topAlign">?</td>
<td class="topAlign"><a href="qstyleoptionq3listview.html">QStyleOptionQ3ListView</a></td>
</tr>
<tr>
<td class="topAlign"><tt>QStyleOption.SO_Q3ListViewItem</tt></td>
<td class="topAlign"><tt>11</tt></td>
<td class="topAlign"><a href="qstyleoptionq3listviewitem.html">QStyleOptionQ3ListViewItem</a></td>
</tr>
</table>
<p><b>See also</b> <a href="qstyleoption.html#type-var">type</a>.</p>


<h3 class="fn"><a name="StyleOptionType-enum" />QStyleOption.StyleOptionType</h3><p>This enum is used to hold information about the type of the
style option, and is defined for each <a href="qstyleoption.html">QStyleOption</a> subclass.</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QStyleOption.Type</tt></td>
<td class="topAlign"><tt>SO_Default</tt></td>
<td class="topAlign">The type of style option provided (<a href="qstyleoption.html#OptionType-enum">SO_Default</a> for this
class).</td>
</tr>
</table>
<p>The type is used internally by <a href="qstyleoption.html">QStyleOption</a>, its subclasses, and <a href="qstyleoption.html#qstyleoption_cast">qstyleoption_cast</a>() to
determine the type of style option. In general you do not need to
worry about this unless you want to create your own <a href="qstyleoption.html">QStyleOption</a> subclass and your own
styles.</p>
<p><b>See also</b> <a href="qstyleoption.html#StyleOptionVersion-enum">StyleOptionVersion</a>.</p>


<h3 class="fn"><a name="StyleOptionVersion-enum" />QStyleOption.StyleOptionVersion</h3><p>This enum is used to hold information about the version of the
style option, and is defined for each <a href="qstyleoption.html">QStyleOption</a> subclass.</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QStyleOption.Version</tt></td>
<td class="topAlign"><tt>1</tt></td>
<td class="topAlign">1</td>
</tr>
</table>
<p>The version is used by <a href="qstyleoption.html">QStyleOption</a> subclasses to implement
extensions without breaking compatibility. If you use <a href="qstyleoption.html#qstyleoption_cast">qstyleoption_cast</a>(), you
normally do not need to check it.</p>
<p><b>See also</b> <a href="qstyleoption.html#StyleOptionType-enum">StyleOptionType</a>.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QStyleOption" />QStyleOption.__init__ (<i>self</i>, int&#160;<i>version</i>&#160;=&#160;QStyleOption.Version, int&#160;<i>type</i>&#160;=&#160;QStyleOption.SO_Default)</h3><p>Constructs a <a href="qstyleoption.html">QStyleOption</a> with
the specified <i>version</i> and <i>type</i>.</p>
<p>The version has no special meaning for <a href="qstyleoption.html">QStyleOption</a>; it can be used by subclasses
to distinguish between different version of the same option
type.</p>
<p>The <a href="qstyleoption.html#state-var">state</a> member
variable is initialized to <a href="qstyle.html#StateFlag-enum">QStyle.State_None</a>.</p>
<p><b>See also</b> <a href="qstyleoption.html#version-var">version</a> and <a href="qstyleoption.html#type-var">type</a>.</p>


<h3 class="fn"><a name="QStyleOption-2" />QStyleOption.__init__ (<i>self</i>, <a href="qstyleoption.html">QStyleOption</a>&#160;<i>other</i>)</h3><p>Constructs a copy of <i>other</i>.</p>


<h3 class="fn"><a name="init" />QStyleOption.init (<i>self</i>, <a href="qwidget.html">QWidget</a>&#160;<i>w</i>)</h3><h3 class="fn"><a name="initFrom" />QStyleOption.initFrom (<i>self</i>, <a href="qwidget.html">QWidget</a>&#160;<i>w</i>)</h3><p>Initializes the <a href="qstyleoption.html#state-var">state</a>,
<a href="qstyleoption.html#direction-var">direction</a>, <a href="qstyleoption.html#rect-var">rect</a>, <a href="qstyleoption.html#palette-var">palette</a>, and <a href="qstyleoption.html#fontMetrics-var">fontMetrics</a> member
variables based on the specified <i>widget</i>.</p>
<p>This is a convenience function; the member variables can also be
initialized manually.</p>
<p>This function was introduced in Qt 4.1.</p>
<p><b>See also</b> <a href="qwidget.html#layoutDirection-prop">QWidget.layoutDirection</a>(),
<a href="qwidget.html#rect-prop">QWidget.rect</a>(), <a href="qwidget.html#palette-prop">QWidget.palette</a>(), and <a href="qwidget.html#fontMetrics">QWidget.fontMetrics</a>().</p>


<hr /><h2>Member Documentation</h2><h3 class="fn"><a name="direction-var" /><a href="qt.html#LayoutDirection-enum">Qt.LayoutDirection</a> direction</h3><p>This variable holds the text layout direction that should be
used when drawing text in the control.</p>
<p>By default, the layout direction is <a href="qt.html#LayoutDirection-enum">Qt.LeftToRight</a>.</p>
<p><b>See also</b> <a href="qstyleoption.html#initFrom">initFrom</a>().</p>


<h3 class="fn"><a name="fontMetrics-var" /><a href="qfontmetrics.html">QFontMetrics</a> fontMetrics</h3><p>This variable holds the font metrics that should be used when
drawing text in the control.</p>
<p>By default, the application's default font is used.</p>
<p><b>See also</b> <a href="qstyleoption.html#initFrom">initFrom</a>().</p>


<h3 class="fn"><a name="palette-var" /><a href="qpalette.html">QPalette</a> palette</h3><p>This variable holds the palette that should be used when
painting the control.</p>
<p>By default, the application's default palette is used.</p>
<p><b>See also</b> <a href="qstyleoption.html#initFrom">initFrom</a>().</p>


<h3 class="fn"><a name="rect-var" /><a href="qrect.html">QRect</a> rect</h3><p>This variable holds the area that should be used for various
calculations and painting.</p>
<p>This can have different meanings for different types of
elements. For example, for a <a href="qstyle.html#ControlElement-enum">QStyle.CE_PushButton</a> element
it would be the rectangle for the entire button, while for a
<a href="qstyle.html#ControlElement-enum">QStyle.CE_PushButtonLabel</a>
element it would be just the area for the push button label.</p>
<p>The default value is a null rectangle, i.e. a rectangle with
both the width and the height set to 0.</p>
<p><b>See also</b> <a href="qstyleoption.html#initFrom">initFrom</a>().</p>


<h3 class="fn"><a name="state-var" /><a href="qstyle-state.html">QStyle.State</a> state</h3><p>This variable holds the style flags that are used when drawing
the control.</p>
<p>The default value is <a href="qstyle.html#StateFlag-enum">QStyle.State_None</a>.</p>
<p><b>See also</b> <a href="qstyleoption.html#initFrom">initFrom</a>(), <a href="qstyle.html#drawPrimitive">QStyle.drawPrimitive</a>(), <a href="qstyle.html#drawControl">QStyle.drawControl</a>(), <a href="qstyle.html#drawComplexControl">QStyle.drawComplexControl</a>(),
and <a href="qstyle.html#StateFlag-enum">QStyle.State</a>.</p>


<h3 class="fn"><a name="type-var" />int type</h3><p>This variable holds the option type of the style option.</p>
<p>The default value is <a href="qstyleoption.html#OptionType-enum">SO_Default</a>.</p>
<p><b>See also</b> <a href="qstyleoption.html#OptionType-enum">OptionType</a>.</p>


<h3 class="fn"><a name="version-var" />int version</h3><p>This variable holds the version of the style option.</p>
<p>This value can be used by subclasses to implement extensions
without breaking compatibility. If you use the <a href="qstyleoption.html#qstyleoption_cast">qstyleoption_cast</a>()
function, you normally do not need to check it.</p>
<p>The default value is 1.</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.12.1 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qt.io">The Qt Company</a> 2015</td><td align="right" width="25%">Qt&#160;4.8.7</td></tr></table></div></address></body></html>