File: qframe.html

package info (click to toggle)
python-qt4 4.9.3-4
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 34,432 kB
  • sloc: python: 34,126; cpp: 11,938; xml: 290; makefile: 223; php: 27
file content (205 lines) | stat: -rw-r--r-- 17,349 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
<?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>QFrame 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">QFrame Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QFrame class is the base class of widgets that can have a
frame. <a href="#details">More...</a></p>

<p>Inherits <a href="qwidget.html">QWidget</a>.</p><p>Inherited by <a href="qabstractscrollarea.html">QAbstractScrollArea</a>, <a href="qlabel.html">QLabel</a>, <a href="qlcdnumber.html">QLCDNumber</a>, <a href="qsplitter.html">QSplitter</a>, <a href="qstackedwidget.html">QStackedWidget</a> and <a href="qtoolbox.html">QToolBox</a>.</p><h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qframe.html#Shadow-enum">Shadow</a></b> { Plain, Raised, Sunken }</li><li><div class="fn" />enum <b><a href="qframe.html#Shape-enum">Shape</a></b> { NoFrame, Box, Panel, WinPanel, ..., StyledPanel }</li><li><div class="fn" />enum <b><a href="qframe.html#StyleMask-enum">StyleMask</a></b> { Shadow_Mask, Shape_Mask }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qframe.html#QFrame">__init__</a></b> (<i>self</i>, QWidget&#160;<i>parent</i>&#160;=&#160;None, Qt.WindowFlags&#160;<i>flags</i>&#160;=&#160;0)</li><li><div class="fn" /><b><a href="qframe.html#changeEvent">changeEvent</a></b> (<i>self</i>, QEvent)</li><li><div class="fn" /><b><a href="qframe.html#drawFrame">drawFrame</a></b> (<i>self</i>, QPainter)</li><li><div class="fn" />bool <b><a href="qframe.html#event">event</a></b> (<i>self</i>, QEvent&#160;<i>e</i>)</li><li><div class="fn" />QRect <b><a href="qframe.html#frameRect">frameRect</a></b> (<i>self</i>)</li><li><div class="fn" />Shadow <b><a href="qframe.html#frameShadow">frameShadow</a></b> (<i>self</i>)</li><li><div class="fn" />Shape <b><a href="qframe.html#frameShape">frameShape</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qframe.html#frameStyle">frameStyle</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qframe.html#frameWidth">frameWidth</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qframe.html#lineWidth">lineWidth</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qframe.html#midLineWidth">midLineWidth</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qframe.html#paintEvent">paintEvent</a></b> (<i>self</i>, QPaintEvent)</li><li><div class="fn" /><b><a href="qframe.html#setFrameRect">setFrameRect</a></b> (<i>self</i>, QRect)</li><li><div class="fn" /><b><a href="qframe.html#setFrameShadow">setFrameShadow</a></b> (<i>self</i>, Shadow)</li><li><div class="fn" /><b><a href="qframe.html#setFrameShape">setFrameShape</a></b> (<i>self</i>, Shape)</li><li><div class="fn" /><b><a href="qframe.html#setFrameStyle">setFrameStyle</a></b> (<i>self</i>, int)</li><li><div class="fn" /><b><a href="qframe.html#setLineWidth">setLineWidth</a></b> (<i>self</i>, int)</li><li><div class="fn" /><b><a href="qframe.html#setMidLineWidth">setMidLineWidth</a></b> (<i>self</i>, int)</li><li><div class="fn" />QSize <b><a href="qframe.html#sizeHint">sizeHint</a></b> (<i>self</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QFrame class is the base class of widgets that can have a
frame.</p>
<p><a href="qmenu.html">QMenu</a> uses this to "raise" the menu
above the surrounding screen. <a href="qprogressbar.html">QProgressBar</a> has a "sunken" look. <a href="qlabel.html">QLabel</a> has a flat look. The frames of widgets
like these can be changed.</p>
<pre class="cpp">
 <span class="type"><a href="qlabel.html">QLabel</a></span> label(<span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>);
 label<span class="operator">.</span><a href="qframe.html#setFrameStyle">setFrameStyle</a>(<span class="type">QFrame</span><span class="operator">.</span>Panel <span class="operator">|</span> <span class="type">QFrame</span><span class="operator">.</span>Raised);
 label<span class="operator">.</span><a href="qframe.html#lineWidth-prop">setLineWidth</a>(<span class="number">2</span>);

 <span class="type"><a href="qprogressbar.html">QProgressBar</a></span> pbar(<span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>);
 label<span class="operator">.</span><a href="qframe.html#setFrameStyle">setFrameStyle</a>(<span class="type">QFrame</span><span class="operator">.</span>NoFrame);
</pre>
<p>The QFrame class can also be used directly for creating simple
placeholder frames without any contents.</p>
<p>The frame style is specified by a <a href="qframe.html#Shape-enum">frame shape</a> and a <a href="qframe.html#Shadow-enum">shadow style</a> that is used to visually
separate the frame from surrounding widgets. These properties can
be set together using the <a href="qframe.html#setFrameStyle">setFrameStyle</a>() function and read
with <a href="qframe.html#frameStyle">frameStyle</a>().</p>
<p>The frame shapes are <a href="qframe.html#Shape-enum">NoFrame</a>, <a href="qframe.html#Shape-enum">Box</a>, <a href="qframe.html#Shape-enum">Panel</a>, <a href="qframe.html#Shape-enum">StyledPanel</a>, <a href="qframe.html#Shape-enum">HLine</a> and <a href="qframe.html#Shape-enum">VLine</a>; the shadow styles are <a href="qframe.html#Shadow-enum">Plain</a>, <a href="qframe.html#Shadow-enum">Raised</a> and <a href="qframe.html#Shadow-enum">Sunken</a>.</p>
<p>A frame widget has three attributes that describe the thickness
of the border: <a href="qframe.html#lineWidth-prop">lineWidth</a>,
<a href="qframe.html#midLineWidth-prop">midLineWidth</a>, and
<a href="qframe.html#frameWidth-prop">frameWidth</a>.</p>
<ul>
<li>The line width is the width of the frame border. It can be
modified to customize the frame's appearance.</li>
<li>The mid-line width specifies the width of an extra line in the
middle of the frame, which uses a third color to obtain a special
3D effect. Notice that a mid-line is only drawn for <a href="qframe.html#Shape-enum">Box</a>, <a href="qframe.html#Shape-enum">HLine</a> and <a href="qframe.html#Shape-enum">VLine</a> frames that are raised or
sunken.</li>
<li>The frame width is determined by the frame style, and the
<a href="qframe.html#frameWidth-prop">frameWidth</a>() function is
used to obtain the value defined for the style used.</li>
</ul>
<p>The margin between the frame and the contents of the frame can
be customized with the <a href="qwidget.html#setContentsMargins">QWidget.setContentsMargins</a>()
function.</p>
<a id="picture" name="picture" />
<p>This table shows some of the combinations of styles and line
widths:</p>
<p class="centerAlign"><img alt="Table of frame styles" src="images/frames.png" /></p>
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="Shadow-enum" />QFrame.Shadow</h3><p>This enum type defines the types of shadow that are used to give
a 3D effect to frames.</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>QFrame.Plain</tt></td>
<td class="topAlign"><tt>0x0010</tt></td>
<td class="topAlign">the frame and contents appear level with the
surroundings; draws using the palette <a href="qpalette.html#ColorRole-enum">QPalette.WindowText</a> color
(without any 3D effect)</td>
</tr>
<tr>
<td class="topAlign"><tt>QFrame.Raised</tt></td>
<td class="topAlign"><tt>0x0020</tt></td>
<td class="topAlign">the frame and contents appear raised; draws a
3D raised line using the light and dark colors of the current color
group</td>
</tr>
<tr>
<td class="topAlign"><tt>QFrame.Sunken</tt></td>
<td class="topAlign"><tt>0x0030</tt></td>
<td class="topAlign">the frame and contents appear sunken; draws a
3D sunken line using the light and dark colors of the current color
group</td>
</tr>
</table>
<p>Shadow interacts with <a href="qframe.html#Shape-enum">QFrame.Shape</a>, the <a href="qframe.html#lineWidth-prop">lineWidth</a>() and the <a href="qframe.html#midLineWidth-prop">midLineWidth</a>(). See the picture
of the frames in the main class documentation.</p>
<p><b>See also</b> <a href="qframe.html#Shape-enum">QFrame.Shape</a>, <a href="qframe.html#lineWidth-prop">lineWidth</a>(), and <a href="qframe.html#midLineWidth-prop">midLineWidth</a>().</p>


<h3 class="fn"><a name="Shape-enum" />QFrame.Shape</h3><p>This enum type defines the shapes of frame available.</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>QFrame.NoFrame</tt></td>
<td class="topAlign"><tt>0</tt></td>
<td class="topAlign"><a href="qframe.html">QFrame</a> draws
nothing</td>
</tr>
<tr>
<td class="topAlign"><tt>QFrame.Box</tt></td>
<td class="topAlign"><tt>0x0001</tt></td>
<td class="topAlign"><a href="qframe.html">QFrame</a> draws a box
around its contents</td>
</tr>
<tr>
<td class="topAlign"><tt>QFrame.Panel</tt></td>
<td class="topAlign"><tt>0x0002</tt></td>
<td class="topAlign"><a href="qframe.html">QFrame</a> draws a panel
to make the contents appear raised or sunken</td>
</tr>
<tr>
<td class="topAlign"><tt>QFrame.StyledPanel</tt></td>
<td class="topAlign"><tt>0x0006</tt></td>
<td class="topAlign">draws a rectangular panel with a look that
depends on the current GUI style. It can be raised or sunken.</td>
</tr>
<tr>
<td class="topAlign"><tt>QFrame.HLine</tt></td>
<td class="topAlign"><tt>0x0004</tt></td>
<td class="topAlign"><a href="qframe.html">QFrame</a> draws a
horizontal line that frames nothing (useful as separator)</td>
</tr>
<tr>
<td class="topAlign"><tt>QFrame.VLine</tt></td>
<td class="topAlign"><tt>0x0005</tt></td>
<td class="topAlign"><a href="qframe.html">QFrame</a> draws a
vertical line that frames nothing (useful as separator)</td>
</tr>
<tr>
<td class="topAlign"><tt>QFrame.WinPanel</tt></td>
<td class="topAlign"><tt>0x0003</tt></td>
<td class="topAlign">draws a rectangular panel that can be raised
or sunken like those in Windows 2000. Specifying this shape sets
the line width to 2 pixels. WinPanel is provided for compatibility.
For GUI style independence we recommend using StyledPanel
instead.</td>
</tr>
</table>
<p>When it does not call <a href="qstyle.html">QStyle</a>, Shape
interacts with <a href="qframe.html#Shadow-enum">QFrame.Shadow</a>, the <a href="qframe.html#lineWidth-prop">lineWidth</a>() and the <a href="qframe.html#midLineWidth-prop">midLineWidth</a>() to create the
total result. See the picture of the frames in the main class
documentation.</p>
<p><b>See also</b> <a href="qframe.html#Shadow-enum">QFrame.Shadow</a>, <a href="qwidget.html#style">QFrame.style</a>(), and <a href="qstyle.html#drawPrimitive">QStyle.drawPrimitive</a>().</p>


<h3 class="fn"><a name="StyleMask-enum" />QFrame.StyleMask</h3><p>This enum defines two constants that can be used to extract the
two components of <a href="qframe.html#frameStyle">frameStyle</a>():</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>QFrame.Shadow_Mask</tt></td>
<td class="topAlign"><tt>0x00f0</tt></td>
<td class="topAlign">The <a href="qframe.html#Shadow-enum">Shadow</a> part of <a href="qframe.html#frameStyle">frameStyle</a>()</td>
</tr>
<tr>
<td class="topAlign"><tt>QFrame.Shape_Mask</tt></td>
<td class="topAlign"><tt>0x000f</tt></td>
<td class="topAlign">The <a href="qframe.html#Shape-enum">Shape</a>
part of <a href="qframe.html#frameStyle">frameStyle</a>()</td>
</tr>
</table>
<p>Normally, you don't need to use these, since <a href="qframe.html#frameShadow-prop">frameShadow</a>() and <a href="qframe.html#frameShape-prop">frameShape</a>() already extract the
<a href="qframe.html#Shadow-enum">Shadow</a> and the <a href="qframe.html#Shape-enum">Shape</a> parts of <a href="qframe.html#frameStyle">frameStyle</a>().</p>
<p><b>See also</b> <a href="qframe.html#frameStyle">frameStyle</a>() and <a href="qframe.html#setFrameStyle">setFrameStyle</a>().</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QFrame" />QFrame.__init__ (<i>self</i>, <a href="qwidget.html">QWidget</a>&#160;<i>parent</i>&#160;=&#160;None, <a href="qt-windowflags.html">Qt.WindowFlags</a>&#160;<i>flags</i>&#160;=&#160;0)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a frame widget with frame style <a href="qframe.html#Shape-enum">NoFrame</a> and a 1-pixel frame width.</p>
<p>The <i>parent</i> and <i>f</i> arguments are passed to the
<a href="qwidget.html">QWidget</a> constructor.</p>


<h3 class="fn"><a name="changeEvent" />QFrame.changeEvent (<i>self</i>, <a href="qevent.html">QEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#changeEvent">QWidget.changeEvent</a>().</p>


<h3 class="fn"><a name="drawFrame" />QFrame.drawFrame (<i>self</i>, <a href="qpainter.html">QPainter</a>)</h3><h3 class="fn"><a name="event" />bool QFrame.event (<i>self</i>, <a href="qevent.html">QEvent</a>&#160;<i>e</i>)</h3><p>Reimplemented from <a href="qobject.html#event">QObject.event</a>().</p>


<h3 class="fn"><a name="frameRect" /><a href="qrect.html">QRect</a> QFrame.frameRect (<i>self</i>)</h3><h3 class="fn"><a name="frameShadow" /><a href="qframe.html#Shadow-enum">Shadow</a> QFrame.frameShadow (<i>self</i>)</h3><h3 class="fn"><a name="frameShape" /><a href="qframe.html#Shape-enum">Shape</a> QFrame.frameShape (<i>self</i>)</h3><h3 class="fn"><a name="frameStyle" />int QFrame.frameStyle (<i>self</i>)</h3><p>Returns the frame style.</p>
<p>The default value is <a href="qframe.html#Shadow-enum">QFrame.Plain</a>.</p>
<p><b>See also</b> <a href="qframe.html#setFrameStyle">setFrameStyle</a>(), <a href="qframe.html#frameShape-prop">frameShape</a>(), and <a href="qframe.html#frameShadow-prop">frameShadow</a>().</p>


<h3 class="fn"><a name="frameWidth" />int QFrame.frameWidth (<i>self</i>)</h3><h3 class="fn"><a name="lineWidth" />int QFrame.lineWidth (<i>self</i>)</h3><h3 class="fn"><a name="midLineWidth" />int QFrame.midLineWidth (<i>self</i>)</h3><h3 class="fn"><a name="paintEvent" />QFrame.paintEvent (<i>self</i>, <a href="qpaintevent.html">QPaintEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#paintEvent">QWidget.paintEvent</a>().</p>


<h3 class="fn"><a name="setFrameRect" />QFrame.setFrameRect (<i>self</i>, <a href="qrect.html">QRect</a>)</h3><h3 class="fn"><a name="setFrameShadow" />QFrame.setFrameShadow (<i>self</i>, <a href="qframe.html#Shadow-enum">Shadow</a>)</h3><h3 class="fn"><a name="setFrameShape" />QFrame.setFrameShape (<i>self</i>, <a href="qframe.html#Shape-enum">Shape</a>)</h3><h3 class="fn"><a name="setFrameStyle" />QFrame.setFrameStyle (<i>self</i>, int)</h3><p>Sets the frame style to <i>style</i>.</p>
<p>The <i>style</i> is the bitwise OR between a frame shape and a
frame shadow style. See the picture of the frames in the main class
documentation.</p>
<p>The frame shapes are given in <a href="qframe.html#Shape-enum">QFrame.Shape</a> and the shadow styles in
<a href="qframe.html#Shadow-enum">QFrame.Shadow</a>.</p>
<p>If a mid-line width greater than 0 is specified, an additional
line is drawn for <a href="qframe.html#Shadow-enum">Raised</a> or
<a href="qframe.html#Shadow-enum">Sunken</a> <a href="qframe.html#Shape-enum">Box</a>, <a href="qframe.html#Shape-enum">HLine</a>, and <a href="qframe.html#Shape-enum">VLine</a> frames. The mid-color of the
current color group is used for drawing middle lines.</p>
<p><b>See also</b> <a href="qframe.html#frameStyle">frameStyle</a>().</p>


<h3 class="fn"><a name="setLineWidth" />QFrame.setLineWidth (<i>self</i>, int)</h3><h3 class="fn"><a name="setMidLineWidth" />QFrame.setMidLineWidth (<i>self</i>, int)</h3><h3 class="fn"><a name="sizeHint" /><a href="qsize.html">QSize</a> QFrame.sizeHint (<i>self</i>)</h3><p>Reimplemented from <a href="qwidget.html#sizeHint-prop">QWidget.sizeHint</a>().</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.9.3 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.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt&#160;4.8.2</td></tr></table></div></address></body></html>