Qtopia Home - Classes - Hierachy - Annotated - Functions - Licenses - Reference |
|
The QFrame class is the base class of widgets that can have a frame. More...
#include <qframe.h>
Inherits QWidget.
Inherited by QScrollView, QHBox, QProgressBar, QWidgetStack, QTableView, QLabel, Ticker, QPopupMenu, QMenuBar, QSpinBox, QGroupBox, QGrid, QLCDNumber, and QSplitter.
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().
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 such as these can be changed.
QLabel label(...);
label.setFrameStyle( QFrame::Panel | QFrame::Raised );
label.setLineWidth( 2 );
QProgressBar pbar(...);
label.setFrameStyle( QFrame::NoFrame );
The 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.
A frame widget has four attributes: frameStyle(), lineWidth(), midLineWidth(), and margin().
The frame style is specified by a frame shape and a shadow style. The frame shapes are NoFrame, Box, Panel, StyledPanel, PopupPanel, WinPanel, HLine and VLine, and the shadow styles are Plain, Raised and Sunken.
The line width is the width of the frame border.
The 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 Box, HLine and VLine frames that are raised or sunken.
The margin is the gap between the frame and the contents of the frame.
This table shows the most useful combinations of styles and widths (and some rather useless ones):
See also
This enum type defines the 3D effect used for QFrame's frame. The currently defined effects are:
Shadow interacts with QFrame::Shape, the lineWidth() and the midLineWidth(). The picture of the frames in the class documentation may illustrate this better than words.
See also QFrame::Shape, lineWidth(), and midLineWidth().
This enum type defines the shapes of a QFrame's frame. The currently defined shapes are:
When 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.
See also QFrame::Shadow, QFrame::style(), QStyle::drawPanel(), and QStyle::drawPopupPanel().
The last argument exists for compatibility with Qt 1.x; it no longer has any meaning.
The parent, name and f arguments are passed to the QWidget constructor.
See also frameRect() and drawContents().
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.
This function is reimplemented by subclasses that draw something inside the frame. It should draw only inside contentsRect(). The default function does nothing.
See also contentsRect(), QPainter::setClipRect(), and drawContentsMask().
Reimplemented in QLabel, QPopupMenu, QMenuBar, and QLCDNumber.
If you reimplemented drawContents(QPainter*) and your widget should support transparency you probably have to re-implement this function as well.
The default implementation masks the contents-rect.
See also drawContents(), updateMask(), QWidget::setAutoMask(), contentsRect(), and QPainter::setClipRect().
Reimplemented in QProgressBar and QLabel.
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.
See also frameRect(), contentsRect(), drawContents(), frameStyle(), setPalette(), and drawFrameMask().
If you reimplemented drawFrame(QPainter*) and your widget should support transparency you probably have to re-implement this function as well.
See also drawFrame(), updateMask(), QWidget::setAutoMask(), and QPainter::setClipRect().
This function can be reimplemented by subclasses that need to know when the frame attributes change.
The default implementation calls update().
The default frame rectangle is equivalent to the widget rectangle.
See also setFrameRect().
See also setFrameShadow(), frameStyle(), and frameShape().
See also setFrameShape(), frameStyle(), and frameShadow().
The default value is QFrame::NoFrame.
See also setFrameStyle(), frameShape(), and frameShadow().
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 0, while the style Panel has a frame width equivalent to the line width. The frame width also includes the margin.
See also lineWidth(), midLineWidth(), frameStyle(), and margin().
The default value is 1.
See also setLineWidth(), midLineWidth(), and frameWidth().
The margin is filled according to backgroundMode().
The default value is 0.
See also setMargin(), lineWidth(), and frameWidth().
The default value is 0.
See also setMidLineWidth(), lineWidth(), and frameWidth().
Paints the frame and the contents.
Opens the painter on the frame and calls first drawFrame(), then drawContents().
Reimplemented from QWidget.
Reimplemented in QTableView.
Adjusts the frame rectangle for the resized widget. The frame rectangle is elastic, the surrounding area is static.
The resulting frame rectangle may be null or invalid. You can use setMinimumSize() to avoid that possibility.
Nothing is done if the frame rectangle is a null rectangle already.
Reimplemented from QWidget.
The frame rectangle is the rectangle the frame is drawn in. By default, this is the entire widget. Calling setFrameRect() does not cause a widget update.
If r is a null rectangle (for example
QRect(0,0,0,0)), then the frame rectangle is equivalent
to the widget rectangle.
See also frameRect() and contentsRect().
See also frameShadow(), frameStyle(), and setFrameShape().
See also frameShape(), frameStyle(), and setFrameShadow().
The style is the bitwise OR between a frame shape and a frame shadow style. See the illustration in the class documentation.
The frame shapes are:
The shadow styles are:
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.
See also Illustration, frameStyle(), colorGroup(), and QColorGroup.
See also frameWidth(), lineWidth(), and setMidLineWidth().
See also margin() and setLineWidth().
See also midLineWidth() and setLineWidth().
Reimplementation of QWidget::updateMask(). Draws the mask of the frame when transparency is required.
This function calls the virtual functions drawFrameMask() and drawContentsMask(). These are the ones you may want to reimplement in subclasses.
See also QWidget::setAutoMask(), drawFrameMask(), and drawContentsMask().
Reimplemented from QWidget.
This file is part of the Qtopia platform, copyright © 1995-2005 Trolltech, all rights reserved.
| Copyright © 2005 Trolltech | Trademarks | Qtopia version 2.2.0
|