1QFrame(3qt) QFrame(3qt)
2
3
4
6 QFrame - The base class of widgets that can have a frame
7
9 #include <qframe.h>
10
11 Inherits QWidget.
12
13 Inherited by QGroupBox, QScrollView, QDockWindow, QGrid, QHBox, QLabel,
14 QLCDNumber, QLineEdit, QMenuBar, QPopupMenu, QProgressBar, QSplitter,
15 QToolBox, and QWidgetStack.
16
17 Public Members
18 QFrame ( QWidget * parent = 0, const char * name = 0, WFlags f = 0 )
19 int frameStyle () const
20 virtual void setFrameStyle ( int style )
21 int frameWidth () const
22 QRect contentsRect () const
23 enum Shape { NoFrame = 0, Box = 0x0001, Panel = 0x0002, WinPanel =
24 0x0003, HLine = 0x0004, VLine = 0x0005, StyledPanel = 0x0006,
25 PopupPanel = 0x0007, MenuBarPanel = 0x0008, ToolBarPanel = 0x0009,
26 LineEditPanel = 0x000a, TabWidgetPanel = 0x000b, GroupBoxPanel =
27 0x000c, MShape = 0x000f }
28 enum Shadow { Plain = 0x0010, Raised = 0x0020, Sunken = 0x0030, MShadow
29 = 0x00f0 }
30 Shape frameShape () const
31 void setFrameShape ( Shape )
32 Shadow frameShadow () const
33 void setFrameShadow ( Shadow )
34 int lineWidth () const
35 virtual void setLineWidth ( int )
36 int margin () const
37 virtual void setMargin ( int )
38 int midLineWidth () const
39 virtual void setMidLineWidth ( int )
40 QRect frameRect () const
41 virtual void setFrameRect ( const QRect & )
42
43 Properties
44 QRect contentsRect - the rectangle inside the frame (read only)
45 QRect frameRect - the frame rectangle
46 Shadow frameShadow - the frame shadow value from the frame style
47 Shape frameShape - the frame shape value from the frame style
48 int frameWidth - the width of the frame that is drawn (read only)
49 int lineWidth - the line width
50 int margin - the width of the margin
51 int midLineWidth - the width of the mid-line
52
53 Protected Members
54 virtual void paintEvent ( QPaintEvent * event )
55 virtual void resizeEvent ( QResizeEvent * e )
56 virtual void drawFrame ( QPainter * p )
57 virtual void drawContents ( QPainter * )
58 virtual void frameChanged ()
59
61 The QFrame class is the base class of widgets that can have a frame.
62
63 It draws a frame and calls a virtual function, drawContents(), to fill
64 in the frame. This function is reimplemented by subclasses. There are
65 also two other less useful functions: drawFrame() and frameChanged().
66
67 QPopupMenu uses this to "raise" the menu above the surrounding screen.
68 QProgressBar has a "sunken" look. QLabel has a flat look. The frames of
69 widgets like these can be changed.
70
71 QLabel label(...);
72 label.setFrameStyle( QFrame::Panel | QFrame::Raised );
73 label.setLineWidth( 2 );
74 QProgressBar pbar(...);
75 label.setFrameStyle( QFrame::NoFrame );
76
77 The QFrame class can also be used directly for creating simple frames
78 without any contents, although usually you would use a QHBox or QVBox
79 because they automatically lay out the widgets you put inside the
80 frame.
81
82 A frame widget has four attributes: frameStyle(), lineWidth(),
83 midLineWidth(), and margin().
84
85 The frame style is specified by a frame shape and a shadow style. The
86 frame shapes are NoFrame, Box, Panel, StyledPanel, PopupPanel,
87 WinPanel, ToolBarPanel, MenuBarPanel, HLine and VLine; the shadow
88 styles are Plain, Raised and Sunken.
89
90 The line width is the width of the frame border.
91
92 The mid-line width specifies the width of an extra line in the middle
93 of the frame, which uses a third color to obtain a special 3D effect.
94 Notice that a mid-line is only drawn for Box, HLine and VLine frames
95 that are raised or sunken.
96
97 The margin is the gap between the frame and the contents of the frame.
98
99 This table shows the most useful combinations of styles and widths (and
100 some rather useless ones):
101
102 <center>
103 [Image Omitted]
104
105 </center>
106
107 See also Abstract Widget Classes.
108
109 Member Type Documentation
111 This enum type defines the 3D effect used for QFrame's frame.
112
113 QFrame::Plain - the frame and contents appear level with the
114 surroundings; draws using the palette foreground color (without any 3D
115 effect)
116
117 QFrame::Raised - the frame and contents appear raised; draws a 3D
118 raised line using the light and dark colors of the current color group
119
120 QFrame::Sunken - the frame and contents appear sunken; draws a 3D
121 sunken line using the light and dark colors of the current color group
122
123 QFrame::MShadow - internal; mask for the shadow
124
125 Shadow interacts with QFrame::Shape, the lineWidth() and the
126 midLineWidth(). See the picture of the frames in the class description.
127
128 See also QFrame::Shape, lineWidth, and midLineWidth.
129
131 This enum type defines the shapes of a QFrame's frame.
132
133 QFrame::NoFrame - QFrame draws nothing
134
135 QFrame::Box - QFrame draws a box around its contents
136
137 QFrame::Panel - QFrame draws a panel to make the contents appear raised
138 or sunken
139
140 QFrame::StyledPanel - draws a rectangular panel with a look that
141 depends on the current GUI style. It can be raised or sunken.
142
143 QFrame::HLine - QFrame draws a horizontal line that frames nothing
144 (useful as separator)
145
146 QFrame::VLine - QFrame draws a vertical line that frames nothing
147 (useful as separator)
148
149 QFrame::GroupBoxPanel - draws a rectangular panel
150
151 QFrame::WinPanel - draws a rectangular panel that can be raised or
152 sunken like those in Windows 95. Specifying this shape sets the line
153 width to 2 pixels. WinPanel is provided for compatibility. For GUI
154 style independence we recommend using StyledPanel instead.
155
156 QFrame::ToolBarPanel
157
158 QFrame::MenuBarPanel
159
160 QFrame::PopupPanel
161
162 QFrame::LineEditPanel - is used to draw a frame suitable for line
163 edits. The look depends upon the current GUI style.
164
165 QFrame::TabWidgetPanel - is used to draw a frame suitable for tab
166 widgets. The look depends upon the current GUI style.
167
168 QFrame::MShape - internal mask
169
170 When it does not call QStyle, Shape interacts with QFrame::Shadow, the
171 lineWidth() and the midLineWidth() to create the total result. See the
172 picture of the frames in the class description.
173
174 See also QFrame::Shadow, QFrame::style(), and QStyle::drawPrimitive().
175
178 Constructs a frame widget with frame style NoFrame and a 1-pixel frame
179 width.
180
181 The parent, name and f arguments are passed to the QWidget constructor.
182
184 Returns the rectangle inside the frame. See the "contentsRect" property
185 for details.
186
188 Virtual function that draws the contents of the frame.
189
190 The QPainter is already open when you get it, and you must leave it
191 open. Painter transformations are switched off on entry. If you
192 transform the painter, remember to take the frame into account and
193 reset transformation before returning.
194
195 This function is reimplemented by subclasses that draw something inside
196 the frame. It should only draw inside contentsRect(). The default
197 function does nothing.
198
199 See also contentsRect and QPainter::setClipRect().
200
201 Reimplemented in QLabel, QLCDNumber, QMenuBar, and QPopupMenu.
202
204 Draws the frame using the painter p and the current frame attributes
205 and color group. The rectangle inside the frame is not affected.
206
207 This function is virtual, but in general you do not need to reimplement
208 it. If you do, note that the QPainter is already open and must remain
209 open.
210
211 See also frameRect, contentsRect, drawContents(), frameStyle(), and
212 palette.
213
215 Virtual function that is called when the frame style, line width or
216 mid-line width changes.
217
218 This function can be reimplemented by subclasses that need to know when
219 the frame attributes change.
220
221 The default implementation calls update().
222
224 Returns the frame rectangle. See the "frameRect" property for details.
225
227 Returns the frame shadow value from the frame style. See the
228 "frameShadow" property for details.
229
231 Returns the frame shape value from the frame style. See the
232 "frameShape" property for details.
233
235 Returns the frame style.
236
237 The default value is QFrame::NoFrame.
238
239 See also setFrameStyle(), frameShape, and frameShadow.
240
241 Example: scrollview/scrollview.cpp.
242
244 Returns the width of the frame that is drawn. See the "frameWidth"
245 property for details.
246
248 Returns the line width. See the "lineWidth" property for details.
249
251 Returns the width of the margin. See the "margin" property for details.
252
254 Returns the width of the mid-line. See the "midLineWidth" property for
255 details.
256
258 Processes the paint event event.
259
260 Paints the frame and the contents.
261
262 Opens the painter on the frame and calls drawFrame(), then
263 drawContents().
264
265 Examples:
266
267 Reimplemented from QWidget.
268
270 Processes the resize event e.
271
272 Adjusts the frame rectangle for the resized widget. The frame rectangle
273 is elastic, and the surrounding area is static.
274
275 The resulting frame rectangle may be null or invalid. You can use
276 setMinimumSize() to avoid those possibilities.
277
278 Nothing is done if the frame rectangle is a null rectangle already.
279
280 Example: life/life.cpp.
281
282 Reimplemented from QWidget.
283
285 Sets the frame rectangle. See the "frameRect" property for details.
286
288 Sets the frame shadow value from the frame style. See the "frameShadow"
289 property for details.
290
292 Sets the frame shape value from the frame style. See the "frameShape"
293 property for details.
294
296 Sets the frame style to style.
297
298 The style is the bitwise OR between a frame shape and a frame shadow
299 style. See the illustration in the class documentation.
300
301 The frame shapes are given in QFrame::Shape and the shadow styles in
302 QFrame::Shadow.
303
304 If a mid-line width greater than 0 is specified, an additional line is
305 drawn for Raised or Sunken Box, HLine, and VLine frames. The mid-color
306 of the current color group is used for drawing middle lines.
307
308 See also Illustration, frameStyle(), colorGroup, and QColorGroup.
309
310 Examples:
311
313 Sets the line width. See the "lineWidth" property for details.
314
316 Sets the width of the margin. See the "margin" property for details.
317
319 Sets the width of the mid-line. See the "midLineWidth" property for
320 details.
321
322 Property Documentation
324 This property holds the rectangle inside the frame.
325
326 Get this property's value with contentsRect().
327
328 See also frameRect and drawContents().
329
331 This property holds the frame rectangle.
332
333 The frame rectangle is the rectangle the frame is drawn in. By default,
334 this is the entire widget. Setting this property does not cause a
335 widget update.
336
337 If this property is set to a null rectangle (for example QRect(0, 0, 0,
338 0)), then the frame rectangle is equivalent to the widget rectangle.
339
340 See also contentsRect.
341
342 Set this property's value with setFrameRect() and get this property's
343 value with frameRect().
344
346 This property holds the frame shadow value from the frame style.
347
348 Set this property's value with setFrameShadow() and get this property's
349 value with frameShadow().
350
351 See also frameStyle() and frameShape.
352
354 This property holds the frame shape value from the frame style.
355
356 Set this property's value with setFrameShape() and get this property's
357 value with frameShape().
358
359 See also frameStyle() and frameShadow.
360
362 This property holds the width of the frame that is drawn.
363
364 Note that the frame width depends on the frame style, not only the line
365 width and the mid-line width. For example, the style NoFrame always has
366 a frame width of 0, whereas the style Panel has a frame width
367 equivalent to the line width. The frame width also includes the margin.
368
369 See also lineWidth, midLineWidth, frameStyle(), and margin.
370
371 Get this property's value with frameWidth().
372
374 This property holds the line width.
375
376 Note that the total line width for HLine and VLine is given by
377 frameWidth(), not lineWidth().
378
379 The default value is 1.
380
381 See also midLineWidth and frameWidth.
382
383 Set this property's value with setLineWidth() and get this property's
384 value with lineWidth().
385
387 This property holds the width of the margin.
388
389 The margin is the distance between the innermost pixel of the frame and
390 the outermost pixel of contentsRect(). It is included in frameWidth().
391
392 The margin is filled according to backgroundMode().
393
394 The default value is 0.
395
396 See also margin, lineWidth, and frameWidth.
397
398 Set this property's value with setMargin() and get this property's
399 value with margin().
400
402 This property holds the width of the mid-line.
403
404 The default value is 0.
405
406 See also lineWidth and frameWidth.
407
408 Set this property's value with setMidLineWidth() and get this
409 property's value with midLineWidth().
410
411
413 http://doc.trolltech.com/qframe.html
414 http://www.trolltech.com/faq/tech.html
415
417 Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
418 license file included in the distribution for a complete license
419 statement.
420
422 Generated automatically from the source code.
423
425 If you find a bug in Qt, please report it as described in
426 http://doc.trolltech.com/bughowto.html. Good bug reports help us to
427 help you. Thank you.
428
429 The definitive Qt documentation is provided in HTML format; it is
430 located at $QTDIR/doc/html and can be read using Qt Assistant or with a
431 web browser. This man page is provided as a convenience for those users
432 who prefer man pages, although this format is not officially supported
433 by Trolltech.
434
435 If you find errors in this manual page, please report them to qt-
436 bugs@trolltech.com. Please include the name of the manual page
437 (qframe.3qt) and the Qt version (3.3.8).
438
439
440
441Trolltech AS 2 February 2007 QFrame(3qt)