You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tqt3/doc/man/man3/tqframe.3qt

406 lines
16 KiB

'\" t
.TH QFrame 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*-
.\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the
.\" license file included in the distribution for a complete license
.\" statement.
.\"
.ad l
.nh
.SH NAME
QFrame \- The base class of widgets that can have a frame
.SH SYNOPSIS
\fC#include <ntqframe.h>\fR
.PP
Inherits QWidget.
.PP
Inherited by QGroupBox, QScrollView, QDockWindow, QGrid, QHBox, QLabel, QLCDNumber, QLineEdit, QMenuBar, QPopupMenu, QProgressBar, QSplitter, QToolBox, and QWidgetStack.
.PP
.SS "Public Members"
.in +1c
.ti -1c
.BI "\fBQFrame\fR ( QWidget * parent = 0, const char * name = 0, WFlags f = 0 )"
.br
.ti -1c
.BI "int \fBframeStyle\fR () const"
.br
.ti -1c
.BI "virtual void \fBsetFrameStyle\fR ( int style )"
.br
.ti -1c
.BI "int \fBframeWidth\fR () const"
.br
.ti -1c
.BI "QRect \fBcontentsRect\fR () const"
.br
.ti -1c
.BI "enum \fBShape\fR { NoFrame = 0, Box = 0x0001, Panel = 0x0002, WinPanel = 0x0003, HLine = 0x0004, VLine = 0x0005, StyledPanel = 0x0006, PopupPanel = 0x0007, MenuBarPanel = 0x0008, ToolBarPanel = 0x0009, LineEditPanel = 0x000a, TabWidgetPanel = 0x000b, GroupBoxPanel = 0x000c, MShape = 0x000f }"
.br
.ti -1c
.BI "enum \fBShadow\fR { Plain = 0x0010, Raised = 0x0020, Sunken = 0x0030, MShadow = 0x00f0 }"
.br
.ti -1c
.BI "Shape \fBframeShape\fR () const"
.br
.ti -1c
.BI "void \fBsetFrameShape\fR ( Shape )"
.br
.ti -1c
.BI "Shadow \fBframeShadow\fR () const"
.br
.ti -1c
.BI "void \fBsetFrameShadow\fR ( Shadow )"
.br
.ti -1c
.BI "int \fBlineWidth\fR () const"
.br
.ti -1c
.BI "virtual void \fBsetLineWidth\fR ( int )"
.br
.ti -1c
.BI "int \fBmargin\fR () const"
.br
.ti -1c
.BI "virtual void \fBsetMargin\fR ( int )"
.br
.ti -1c
.BI "int \fBmidLineWidth\fR () const"
.br
.ti -1c
.BI "virtual void \fBsetMidLineWidth\fR ( int )"
.br
.ti -1c
.BI "QRect \fBframeRect\fR () const"
.br
.ti -1c
.BI "virtual void \fBsetFrameRect\fR ( const QRect & )"
.br
.in -1c
.SS "Properties"
.in +1c
.ti -1c
.BI "QRect \fBcontentsRect\fR - the rectangle inside the frame \fI(read " "only" ")\fR"
.br
.ti -1c
.BI "QRect \fBframeRect\fR - the frame rectangle"
.br
.ti -1c
.BI "Shadow \fBframeShadow\fR - the frame shadow value from the frame style"
.br
.ti -1c
.BI "Shape \fBframeShape\fR - the frame shape value from the frame style"
.br
.ti -1c
.BI "int \fBframeWidth\fR - the width of the frame that is drawn \fI(read " "only" ")\fR"
.br
.ti -1c
.BI "int \fBlineWidth\fR - the line width"
.br
.ti -1c
.BI "int \fBmargin\fR - the width of the margin"
.br
.ti -1c
.BI "int \fBmidLineWidth\fR - the width of the mid-line"
.br
.in -1c
.SS "Protected Members"
.in +1c
.ti -1c
.BI "virtual void \fBpaintEvent\fR ( QPaintEvent * event )"
.br
.ti -1c
.BI "virtual void \fBresizeEvent\fR ( QResizeEvent * e )"
.br
.ti -1c
.BI "virtual void \fBdrawFrame\fR ( QPainter * p )"
.br
.ti -1c
.BI "virtual void \fBdrawContents\fR ( QPainter * )"
.br
.ti -1c
.BI "virtual void \fBframeChanged\fR ()"
.br
.in -1c
.SH DESCRIPTION
The QFrame class is the base class of widgets that can have a frame.
.PP
It draws a frame and calls a virtual function, drawContents(), to fill in the frame. This function is reimplemented by subclasses. There are also two other less useful functions: drawFrame() and frameChanged().
.PP
QPopupMenu uses this to "raise" the menu above the surrounding screen. QProgressBar has a "sunken" look. QLabel has a flat look. The frames of widgets like these can be changed.
.PP
.nf
.br
QLabel label(...);
.br
label.setFrameStyle( QFrame::Panel | QFrame::Raised );
.br
label.setLineWidth( 2 );
.br
.br
QProgressBar pbar(...);
.br
label.setFrameStyle( QFrame::NoFrame );
.br
.fi
.PP
The QFrame class can also be used directly for creating simple frames without any contents, although usually you would use a QHBox or QVBox because they automatically lay out the widgets you put inside the frame.
.PP
A frame widget has four attributes: frameStyle(), lineWidth(), midLineWidth(), and margin().
.PP
The frame style is specified by a frame shape and a shadow style. The frame shapes are NoFrame, Box, Panel, StyledPanel, PopupPanel, WinPanel, ToolBarPanel, MenuBarPanel, HLine and VLine; the shadow styles are Plain, Raised and Sunken.
.PP
The line width is the width of the frame border.
.PP
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 Box, HLine and VLine frames that are raised or sunken.
.PP
The margin is the gap between the frame and the contents of the frame.
.PP
This table shows the most useful combinations of styles and widths (and some rather useless ones):
.PP
<center>
.ce 1
.B "[Image Omitted]"
.PP
</center>
.PP
See also Abstract Widget Classes.
.SS "Member Type Documentation"
.SH "QFrame::Shadow"
This enum type defines the 3D effect used for QFrame's frame.
.TP
\fCQFrame::Plain\fR - the frame and contents appear level with the surroundings; draws using the palette foreground color (without any 3D effect)
.TP
\fCQFrame::Raised\fR - the frame and contents appear raised; draws a 3D raised line using the light and dark colors of the current color group
.TP
\fCQFrame::Sunken\fR - the frame and contents appear sunken; draws a 3D sunken line using the light and dark colors of the current color group
.TP
\fCQFrame::MShadow\fR - internal; mask for the shadow
.PP
Shadow interacts with QFrame::Shape, the lineWidth() and the midLineWidth(). See the picture of the frames in the class description.
.PP
See also QFrame::Shape, lineWidth, and midLineWidth.
.SH "QFrame::Shape"
This enum type defines the shapes of a QFrame's frame.
.TP
\fCQFrame::NoFrame\fR - QFrame draws nothing
.TP
\fCQFrame::Box\fR - QFrame draws a box around its contents
.TP
\fCQFrame::Panel\fR - QFrame draws a panel to make the contents appear raised or sunken
.TP
\fCQFrame::StyledPanel\fR - draws a rectangular panel with a look that depends on the current GUI style. It can be raised or sunken.
.TP
\fCQFrame::HLine\fR - QFrame draws a horizontal line that frames nothing (useful as separator)
.TP
\fCQFrame::VLine\fR - QFrame draws a vertical line that frames nothing (useful as separator)
.TP
\fCQFrame::GroupBoxPanel\fR - draws a rectangular panel
.TP
\fCQFrame::WinPanel\fR - draws a rectangular panel that can be raised or sunken like those in Windows 95. Specifying this shape sets the line width to 2 pixels. WinPanel is provided for compatibility. For GUI style independence we recommend using StyledPanel instead.
.TP
\fCQFrame::ToolBarPanel\fR
.TP
\fCQFrame::MenuBarPanel\fR
.TP
\fCQFrame::PopupPanel\fR
.TP
\fCQFrame::LineEditPanel\fR - is used to draw a frame suitable for line edits. The look depends upon the current GUI style.
.TP
\fCQFrame::TabWidgetPanel\fR - is used to draw a frame suitable for tab widgets. The look depends upon the current GUI style.
.TP
\fCQFrame::MShape\fR - internal mask
.PP
When it does not call QStyle, Shape interacts with QFrame::Shadow, the lineWidth() and the midLineWidth() to create the total result. See the picture of the frames in the class description.
.PP
See also QFrame::Shadow, QFrame::style(), and QStyle::drawPrimitive().
.SH MEMBER FUNCTION DOCUMENTATION
.SH "QFrame::QFrame ( QWidget * parent = 0, const char * name = 0, WFlags f = 0 )"
Constructs a frame widget with frame style NoFrame and a 1-pixel frame width.
.PP
The \fIparent\fR, \fIname\fR and \fIf\fR arguments are passed to the QWidget constructor.
.SH "QRect QFrame::contentsRect () const"
Returns the rectangle inside the frame. See the "contentsRect" property for details.
.SH "void QFrame::drawContents ( QPainter * )\fC [virtual protected]\fR"
Virtual function that draws the contents of the frame.
.PP
The QPainter is already open when you get it, and you must leave it open. Painter transformations are switched off on entry. If you transform the painter, remember to take the frame into account and reset transformation before returning.
.PP
This function is reimplemented by subclasses that draw something inside the frame. It should only draw inside contentsRect(). The default function does nothing.
.PP
See also contentsRect and QPainter::setClipRect().
.PP
Reimplemented in QLabel, QLCDNumber, QMenuBar, and QPopupMenu.
.SH "void QFrame::drawFrame ( QPainter * p )\fC [virtual protected]\fR"
Draws the frame using the painter \fIp\fR and the current frame attributes and color group. The rectangle inside the frame is not affected.
.PP
This function is virtual, but in general you do not need to reimplement it. If you do, note that the QPainter is already open and must remain open.
.PP
See also frameRect, contentsRect, drawContents(), frameStyle(), and palette.
.SH "void QFrame::frameChanged ()\fC [virtual protected]\fR"
Virtual function that is called when the frame style, line width or mid-line width changes.
.PP
This function can be reimplemented by subclasses that need to know when the frame attributes change.
.PP
The default implementation calls update().
.SH "QRect QFrame::frameRect () const"
Returns the frame rectangle. See the "frameRect" property for details.
.SH "Shadow QFrame::frameShadow () const"
Returns the frame shadow value from the frame style. See the "frameShadow" property for details.
.SH "Shape QFrame::frameShape () const"
Returns the frame shape value from the frame style. See the "frameShape" property for details.
.SH "int QFrame::frameStyle () const"
Returns the frame style.
.PP
The default value is QFrame::NoFrame.
.PP
See also setFrameStyle(), frameShape, and frameShadow.
.PP
Example: scrollview/scrollview.cpp.
.SH "int QFrame::frameWidth () const"
Returns the width of the frame that is drawn. See the "frameWidth" property for details.
.SH "int QFrame::lineWidth () const"
Returns the line width. See the "lineWidth" property for details.
.SH "int QFrame::margin () const"
Returns the width of the margin. See the "margin" property for details.
.SH "int QFrame::midLineWidth () const"
Returns the width of the mid-line. See the "midLineWidth" property for details.
.SH "void QFrame::paintEvent ( QPaintEvent * event )\fC [virtual protected]\fR"
Processes the paint event \fIevent\fR.
.PP
Paints the frame and the contents.
.PP
Opens the painter on the frame and calls drawFrame(), then drawContents().
.PP
Examples:
.)l life/life.cpp and qfd/fontdisplayer.cpp.
.PP
Reimplemented from QWidget.
.SH "void QFrame::resizeEvent ( QResizeEvent * e )\fC [virtual protected]\fR"
Processes the resize event \fIe\fR.
.PP
Adjusts the frame rectangle for the resized widget. The frame rectangle is elastic, and the surrounding area is static.
.PP
The resulting frame rectangle may be null or invalid. You can use setMinimumSize() to avoid those possibilities.
.PP
Nothing is done if the frame rectangle is a null rectangle already.
.PP
Example: life/life.cpp.
.PP
Reimplemented from QWidget.
.SH "void QFrame::setFrameRect ( const QRect & )\fC [virtual]\fR"
Sets the frame rectangle. See the "frameRect" property for details.
.SH "void QFrame::setFrameShadow ( Shadow )"
Sets the frame shadow value from the frame style. See the "frameShadow" property for details.
.SH "void QFrame::setFrameShape ( Shape )"
Sets the frame shape value from the frame style. See the "frameShape" property for details.
.SH "void QFrame::setFrameStyle ( int style )\fC [virtual]\fR"
Sets the frame style to \fIstyle\fR.
.PP
The \fIstyle\fR is the bitwise OR between a frame shape and a frame shadow style. See the illustration in the class documentation.
.PP
The frame shapes are given in QFrame::Shape and the shadow styles in QFrame::Shadow.
.PP
If a mid-line width greater than 0 is specified, an additional line is drawn for Raised or Sunken Box, HLine, and VLine frames. The mid-color of the current color group is used for drawing middle lines.
.PP
See also Illustration, frameStyle(), colorGroup, and QColorGroup.
.PP
Examples:
.)l cursor/cursor.cpp, layout/layout.cpp, listboxcombo/listboxcombo.cpp, rangecontrols/rangecontrols.cpp, scrollview/scrollview.cpp, tabdialog/tabdialog.cpp, and tictac/tictac.cpp.
.SH "void QFrame::setLineWidth ( int )\fC [virtual]\fR"
Sets the line width. See the "lineWidth" property for details.
.SH "void QFrame::setMargin ( int )\fC [virtual]\fR"
Sets the width of the margin. See the "margin" property for details.
.SH "void QFrame::setMidLineWidth ( int )\fC [virtual]\fR"
Sets the width of the mid-line. See the "midLineWidth" property for details.
.SS "Property Documentation"
.SH "QRect contentsRect"
This property holds the rectangle inside the frame.
.PP
Get this property's value with contentsRect().
.PP
See also frameRect and drawContents().
.SH "QRect frameRect"
This property holds the frame rectangle.
.PP
The frame rectangle is the rectangle the frame is drawn in. By default, this is the entire widget. Setting this property does \fInot\fR cause a widget update.
.PP
If this property is set to a null rectangle (for example \fCQRect(0, 0, 0, 0)\fR), then the frame rectangle is equivalent to the widget rectangle.
.PP
See also contentsRect.
.PP
Set this property's value with setFrameRect() and get this property's value with frameRect().
.SH "Shadow frameShadow"
This property holds the frame shadow value from the frame style.
.PP
Set this property's value with setFrameShadow() and get this property's value with frameShadow().
.PP
See also frameStyle() and frameShape.
.SH "Shape frameShape"
This property holds the frame shape value from the frame style.
.PP
Set this property's value with setFrameShape() and get this property's value with frameShape().
.PP
See also frameStyle() and frameShadow.
.SH "int frameWidth"
This property holds the width of the frame that is drawn.
.PP
Note that the frame width depends on the frame style, not only the line width and the mid-line width. For example, the style NoFrame always has a frame width of 0, whereas the style Panel has a frame width equivalent to the line width. The frame width also includes the margin.
.PP
See also lineWidth, midLineWidth, frameStyle(), and margin.
.PP
Get this property's value with frameWidth().
.SH "int lineWidth"
This property holds the line width.
.PP
Note that the \fItotal\fR line width for HLine and VLine is given by frameWidth(), not lineWidth().
.PP
The default value is 1.
.PP
See also midLineWidth and frameWidth.
.PP
Set this property's value with setLineWidth() and get this property's value with lineWidth().
.SH "int margin"
This property holds the width of the margin.
.PP
The margin is the distance between the innermost pixel of the frame and the outermost pixel of contentsRect(). It is included in frameWidth().
.PP
The margin is filled according to backgroundMode().
.PP
The default value is 0.
.PP
See also margin, lineWidth, and frameWidth.
.PP
Set this property's value with setMargin() and get this property's value with margin().
.SH "int midLineWidth"
This property holds the width of the mid-line.
.PP
The default value is 0.
.PP
See also lineWidth and frameWidth.
.PP
Set this property's value with setMidLineWidth() and get this property's value with midLineWidth().
.SH "SEE ALSO"
.BR http://doc.trolltech.com/ntqframe.html
.BR http://www.trolltech.com/faq/tech.html
.SH COPYRIGHT
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
license file included in the distribution for a complete license
statement.
.SH AUTHOR
Generated automatically from the source code.
.SH BUGS
If you find a bug in Qt, please report it as described in
.BR http://doc.trolltech.com/bughowto.html .
Good bug reports help us to help you. Thank you.
.P
The definitive Qt documentation is provided in HTML format; it is
located at $QTDIR/doc/html and can be read using Qt Assistant or with
a web browser. This man page is provided as a convenience for those
users who prefer man pages, although this format is not officially
supported by Trolltech.
.P
If you find errors in this manual page, please report them to
.BR qt-bugs@trolltech.com .
Please include the name of the manual page (tqframe.3qt) and the Qt
version (3.3.8).