📄 qframe.3qt
字号:
.TH QFrame 3qt "10 November 2000" "Trolltech AS" \" -*- nroff -*-.\" Copyright 1992-2000 Trolltech AS. All rights reserved. See the.\" license file included in the distribution for a complete license.\" statement..\".ad l.nh.SH NAMEQFrame \- The base class of widgets that can have a frame.SH SYNOPSIS.br.PP\fC#include <qframe.h>\fR.PPInherits QWidget..PPInherited by QGrid, QGroupBox, QHBox, QLCDNumber, QLabel, QMenuBar, QPopupMenu, QProgressBar, QScrollView, QSpinBox, QSplitter, QTableView and QWidgetStack..PP.SS "Public Members".in +1c.ti -1c.BI "\fBQFrame\fR ( QWidget * " "parent" "=0, const char * " "name" "=0, WFlags " "f" "=0, bool = TRUE ) ".br.ti -1c.BI "int \fBframeStyle\fR () const".br.ti -1c.BI "virtual void \fBsetFrameStyle\fR ( int ) ".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, 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 "Protected Members".in +1c.ti -1c.BI "virtual void \fBpaintEvent\fR ( QPaintEvent * ) ".br.ti -1c.BI "virtual void \fBresizeEvent\fR ( QResizeEvent * ) ".br.ti -1c.BI "virtual void \fBdrawFrame\fR ( QPainter * ) ".br.ti -1c.BI "virtual void \fBdrawContents\fR ( QPainter * ) ".br.ti -1c.BI "virtual void \fBframeChanged\fR () ".br.ti -1c.BI "virtual void \fBupdateMask\fR () ".br.ti -1c.BI "virtual void \fBdrawFrameMask\fR ( QPainter * ) ".br.ti -1c.BI "virtual void \fBdrawContentsMask\fR ( QPainter * ) ".br.in -1c.SS "Properties"<table border=1 cellpadding=3 cellspacing=0> <tr><th>Type<th>Name<th>READ<th>WRITE<th>Options <tr><td>int<td>frameWidth<td>frameWidth<td> <td> <tr><td>QRect<td>contentsRect<td>contentsRect<td> <td> <tr><td>Shape<td>frameShape<td>frameShape<td>setFrameShape<td> <tr><td>Shadow<td>frameShadow<td>frameShadow<td>setFrameShadow<td> <tr><td>int<td>lineWidth<td>lineWidth<td>setLineWidth<td> <tr><td>int<td>margin<td>margin<td>setMargin<td> <tr><td>int<td>midLineWidth<td>midLineWidth<td>setMidLineWidth<td> <tr><td>QRect<td>frameRect<td>frameRect<td>setFrameRect<td> DESIGNABLE false </table>.SH DESCRIPTIONThe QFrame class is the base class of widgets that can have a frame..PPIt 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()..PPQPopupMenu uses this to "raise" the menu above the surrounding screen. QProgressBar has a "sunken" look. QLabel has a flat look. The frames of widgets such as 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 );.fi.PPThe QFrame class can also be used directly for creating simple frames without any contents, although usually you would use a QHBox or QVBox as these layout the widgets you put inside the frame..PPA frame widget has four attributes: frameStyle(), lineWidth(), midLineWidth(), and margin()..PPThe frame style is specified by a frame shape and a shadow style. The frame shapes are \fCNoFrame, Box, Panel, StyledPanel, PopupPanel, WinPanel, HLine\fR and \fCVLine,\fR and the shadow styles are \fCPlain, Raised\fR and \fCSunken.\fR.PPThe line width is the width of the frame border..PPThe mid-line width specifies the width of an extra line in the middle of the frame, that uses a third color to obtain a special 3D effect. Notice that a mid-line is only drawn for \fCBox, HLine\fR and \fCVLine\fR frames that are raised or sunken..PPThe margin is the gap between the frame and the contents of the frame..PPThis table shows the most useful combinations of styles and widths (and some rather useless ones):.PP<img src=frames.png width=515 height=414 alt="Table of frame styles">.PPExamples:.(lpopup/popup.cpp scrollview/scrollview.cpp movies/main.cpp.)l.SS "Member Type Documentation".SH "QFrame::Shadow"This enum type defines the 3D effect used for QFrame's frame. The currently defined effects are: .TP\fCPlain\fR - the frame and contents appear level with the surroundings.TP\fCRaised\fR - the frame and contents appear raised.TP\fCSunken\fR - the frame and contents appear sunken.IP.PPShadow interacts with QFrame::Shape, the lineWidth() and the midLineWidth(). The picture of the frames in the class documentation may illustrate this better than words..PPSee also QFrame::Shape, lineWidth() and midLineWidth()..SH "QFrame::Shape"This enum type defines the shapes of a QFrame's frame. The currently defined shapes are: .TP\fCNoFrame\fR - QFrame draws nothing.TP\fCBox\fR - QFrame draws a box around its contents.TP\fCPanel\fR - QFrame draws a panel such that the contents appear raised or sunken.TP\fCWinPanel\fR - like \fCPanel,\fR but QFrame draws the 3D effects the way Microsoft Windows 95 (etc) does.TP\fCHLine\fR - QFrame draws a horizontal line that frames nothing (useful as separator).TP\fCVLine\fR - QFrame draws a vertical line that frames nothing (useful as separator).TP\fCStyledPanel\fR - QFrame calls QStyle::drawPanel().TP\fCPopupPanel\fR - QFrame calls QStyle::drawPopupPanel().IP.PPWhen it does not call QStyle, Shape interacts with QFrame::Shadow, the lineWidth() and the midLineWidth() to create the total result. The picture of the frames in the class documentation may illustrate this better than words..PPSee also QFrame::Shadow, QFrame::style(), QStyle::drawPanel() and QStyle::drawPopupPanel()..SH MEMBER FUNCTION DOCUMENTATION.SH "QFrame::QFrame ( QWidget * parent=0, const char * name=0, WFlags f=0, bool = TRUE )"Constructs a frame widget with frame style \fCNoFrame\fR and a 1 pixel frame width..PPThe last argument exists for compatibility with Qt 1.x; it no longer has any meaning..PPThe \fIparent, name\fR and \fIf\fR arguments are passed to the QWidget constructor..SH "QRect QFrame::contentsRect () const"Returns the rectangle inside the frame..PPSee also frameRect() and drawContents()..SH "void QFrame::drawContents ( QPainter * ) \fC[virtual protected]\fR"Virtual function that draws the contents of the frame..PPThe 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..PPThis function is reimplemented by subclasses that draw something inside the frame. It should draw only inside contentsRect(). The default function does nothing..PPSee also contentsRect(), QPainter::setClipRect() and drawContentsMask()..PPReimplemented in QPopupMenu, QProgressBar, QMenuBar, QLabel and QLCDNumber..SH "void QFrame::drawContentsMask ( QPainter * p ) \fC[virtual protected]\fR"Virtual function that draws the mask of the frame's contents..PPIf you reimplemented drawContents(QPainter*) and your widget should support transparency you probably have to re-implement this function as well..PPThe default implementation masks the contents-rect..PPSee also drawContents(), updateMask(), QWidget::setAutoMask(), contentsRect() and QPainter::setClipRect()..PP
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -