QtBase
v6.3.1
|
The QFrame class is the base class of widgets that can have a frame. More...
#include <qframe.h>
Public Types | |
enum | Shape { NoFrame = 0 , Box = 0x0001 , Panel = 0x0002 , WinPanel = 0x0003 , HLine = 0x0004 , VLine = 0x0005 , StyledPanel = 0x0006 } |
enum | Shadow { Plain = 0x0010 , Raised = 0x0020 , Sunken = 0x0030 } |
enum | StyleMask { Shadow_Mask = 0x00f0 , Shape_Mask = 0x000f } |
Public Types inherited from QWidget | |
enum | RenderFlag { DrawWindowBackground = 0x1 , DrawChildren = 0x2 , IgnoreMask = 0x4 } |
Public Types inherited from QPaintDevice | |
enum | PaintDeviceMetric { PdmWidth = 1 , PdmHeight , PdmWidthMM , PdmHeightMM , PdmNumColors , PdmDepth , PdmDpiX , PdmDpiY , PdmPhysicalDpiX , PdmPhysicalDpiY , PdmDevicePixelRatio , PdmDevicePixelRatioScaled } |
Properties | |
Shape | frameShape |
the frame shape value from the frame style More... | |
Shadow | frameShadow |
the frame shadow value from the frame style More... | |
int | lineWidth |
the line width More... | |
int | midLineWidth |
the width of the mid-line More... | |
int | frameWidth |
the width of the frame that is drawn. More... | |
QRect | frameRect |
the frame's rectangle More... | |
Properties inherited from QWidget | |
bool | modal |
whether the widget is a modal widget More... | |
Qt::WindowModality | windowModality |
which windows are blocked by the modal widget More... | |
bool | enabled |
whether the widget is enabled More... | |
QRect | geometry |
the geometry of the widget relative to its parent and excluding the window frame More... | |
QRect | frameGeometry |
geometry of the widget relative to its parent including any window frame More... | |
QRect | normalGeometry |
the geometry of the widget as it will appear when shown as a normal (not maximized or full screen) top-level widget More... | |
int | x |
the x coordinate of the widget relative to its parent including any window frame More... | |
int | y |
the y coordinate of the widget relative to its parent and including any window frame More... | |
QPoint | pos |
the position of the widget within its parent widget More... | |
QSize | frameSize |
the size of the widget including any window frame More... | |
QSize | size |
the size of the widget excluding any window frame More... | |
int | width |
the width of the widget excluding any window frame More... | |
int | height |
the height of the widget excluding any window frame More... | |
QRect | rect |
the internal geometry of the widget excluding any window frame More... | |
QRect | childrenRect |
the bounding rectangle of the widget's children More... | |
QRegion | childrenRegion |
the combined region occupied by the widget's children More... | |
QSizePolicy | sizePolicy |
the default layout behavior of the widget More... | |
QSize | minimumSize |
the widget's minimum size More... | |
QSize | maximumSize |
the widget's maximum size in pixels More... | |
int | minimumWidth |
the widget's minimum width in pixels More... | |
int | minimumHeight |
the widget's minimum height in pixels More... | |
int | maximumWidth |
the widget's maximum width in pixels More... | |
int | maximumHeight |
the widget's maximum height in pixels More... | |
QSize | sizeIncrement |
the size increment of the widget More... | |
QSize | baseSize |
the base size of the widget More... | |
QPalette | palette |
the widget's palette More... | |
QFont | font |
the font currently set for the widget More... | |
QCursor | cursor |
the cursor shape for this widget More... | |
bool | mouseTracking |
whether mouse tracking is enabled for the widget More... | |
bool | tabletTracking |
whether tablet tracking is enabled for the widget More... | |
bool | isActiveWindow |
whether this widget's window is the active window More... | |
Qt::FocusPolicy | focusPolicy |
the way the widget accepts keyboard focus More... | |
bool | focus |
whether this widget (or its focus proxy) has the keyboard input focus More... | |
Qt::ContextMenuPolicy | contextMenuPolicy |
how the widget shows a context menu More... | |
bool | updatesEnabled |
whether updates are enabled More... | |
bool | visible |
whether the widget is visible More... | |
bool | minimized |
whether this widget is minimized (iconified) More... | |
bool | maximized |
whether this widget is maximized More... | |
bool | fullScreen |
whether the widget is shown in full screen mode More... | |
QSize | sizeHint |
the recommended size for the widget More... | |
QSize | minimumSizeHint |
the recommended minimum size for the widget More... | |
bool | acceptDrops |
whether drop events are enabled for this widget More... | |
QString | windowTitle |
the window title (caption) More... | |
QIcon | windowIcon |
the widget's icon More... | |
QString | windowIconText |
the text to be displayed on the icon of a minimized window More... | |
double | windowOpacity |
The level of opacity for the window. More... | |
bool | windowModified |
whether the document shown in the window has unsaved changes More... | |
QString | accessibleName |
the widget's name as seen by assistive technologies More... | |
QString | accessibleDescription |
the widget's description as seen by assistive technologies More... | |
Qt::LayoutDirection | layoutDirection |
the layout direction for this widget. More... | |
bool | autoFillBackground |
whether the widget background is filled automatically More... | |
QString | styleSheet |
the widget's style sheet More... | |
QLocale | locale |
the widget's locale More... | |
QString | windowFilePath |
the file path associated with a widget More... | |
Qt::InputMethodHints | inputMethodHints |
What input method specific hints the widget has. More... | |
Properties inherited from QObject | |
QString | objectName |
the name of this object More... | |
The QFrame class is the base class of widgets that can have a frame.
\inmodule QtWidgets
QMenu 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.
The QFrame class can also be used directly for creating simple placeholder frames without any contents.
The frame style is specified by a \l{QFrame::Shape}{frame shape} and a \l{QFrame::Shadow}{shadow style} that is used to visually separate the frame from surrounding widgets. These properties can be set together using the setFrameStyle() function and read with frameStyle().
The frame shapes are \l NoFrame, \l Box, \l Panel, \l StyledPanel, HLine and \l VLine; the shadow styles are \l Plain, \l Raised and \l Sunken.
A frame widget has three attributes that describe the thickness of the border: \l lineWidth, \l midLineWidth, and \l frameWidth.
\list
The margin between the frame and the contents of the frame can be customized with the QWidget::setContentsMargins() function.
\target picture This table shows some of the combinations of styles and line widths:
Table of frame styles
enum QFrame::Shadow |
This enum type defines the types of shadow that are used to give a 3D effect to frames.
\value Plain the frame and contents appear level with the surroundings; draws using the palette QPalette::WindowText color (without any 3D effect)
\value Raised the frame and contents appear raised; draws a 3D raised line using the light and dark colors of the current color group \value Sunken the frame and contents appear sunken; draws a 3D sunken line using the light and dark colors of the current color group
Shadow interacts with QFrame::Shape, the lineWidth() and the midLineWidth(). See the picture of the frames in the main class documentation.
Enumerator | |
---|---|
Plain | |
Raised | |
Sunken |
enum QFrame::Shape |
This enum type defines the shapes of frame available.
\value NoFrame QFrame draws nothing \value Box QFrame draws a box around its contents \value Panel QFrame draws a panel to make the contents appear raised or sunken \value StyledPanel draws a rectangular panel with a look that depends on the current GUI style. It can be raised or sunken. \value HLine QFrame draws a horizontal line that frames nothing (useful as separator) \value VLine QFrame draws a vertical line that frames nothing (useful as separator) \value WinPanel 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.
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 main class documentation.
Enumerator | |
---|---|
NoFrame | |
Box | |
Panel | |
WinPanel | |
HLine | |
VLine | |
StyledPanel |
enum QFrame::StyleMask |
This enum defines two constants that can be used to extract the two components of frameStyle():
\value Shadow_Mask The \l Shadow part of frameStyle() \value Shape_Mask The \l Shape part of frameStyle()
Normally, you don't need to use these, since frameShadow() and frameShape() already extract the \l Shadow and the \l Shape parts of frameStyle().
Enumerator | |
---|---|
Shadow_Mask | |
Shape_Mask |
Constructs a frame widget with frame style \l NoFrame and a 1-pixel frame width.
The parent and f arguments are passed to the QWidget constructor.
Definition at line 200 of file qframe.cpp.
QFrame::~QFrame | ( | ) |
Destroys the frame.
Definition at line 262 of file qframe.cpp.
|
protected |
Definition at line 208 of file qframe.cpp.
Definition at line 523 of file qframe.cpp.
|
overrideprotectedvirtual |
\reimp
Reimplemented from QWidget.
Reimplemented in ContextMenuWidget, QToolBox, QStackedWidget, QLCDNumber, QLabel, and QSplitter.
Definition at line 546 of file qframe.cpp.
QRect QFrame::frameRect | ( | ) | const |
QFrame::Shadow QFrame::frameShadow | ( | ) | const |
Definition at line 305 of file qframe.cpp.
QFrame::Shape QFrame::frameShape | ( | ) | const |
Definition at line 286 of file qframe.cpp.
int QFrame::frameStyle | ( | ) | const |
Returns the frame style.
The default value is QFrame::Plain.
Definition at line 273 of file qframe.cpp.
int QFrame::frameWidth | ( | ) | const |
Definition at line 454 of file qframe.cpp.
|
protectedvirtual |
Initializes option with the values from this QFrame. This method is useful for subclasses when they need a QStyleOptionFrame but don't want to fill in all the information themselves.
Definition at line 224 of file qframe.cpp.
int QFrame::lineWidth | ( | ) | const |
Definition at line 380 of file qframe.cpp.
int QFrame::midLineWidth | ( | ) | const |
Definition at line 404 of file qframe.cpp.
|
overrideprotectedvirtual |
\reimp
Reimplemented from QWidget.
Reimplemented in View, View, DragWidget, QLCDNumber, and QLabel.
Definition at line 512 of file qframe.cpp.
void QFrame::setFrameShadow | ( | QFrame::Shadow | s | ) |
Definition at line 311 of file qframe.cpp.
Definition at line 292 of file qframe.cpp.
void QFrame::setFrameStyle | ( | int | style | ) |
Sets the frame style to style.
The style is the bitwise OR between a frame shape and a frame shadow style. See the picture of the frames in the main class documentation.
The frame shapes are given in \l{QFrame::Shape} and the shadow styles in \l{QFrame::Shadow}.
If a mid-line width greater than 0 is specified, an additional line is drawn for \l Raised or \l Sunken \l Box, \l HLine, and \l VLine frames. The mid-color of the current color group is used for drawing middle lines.
Definition at line 335 of file qframe.cpp.
void QFrame::setLineWidth | ( | int | w | ) |
void QFrame::setMidLineWidth | ( | int | w | ) |
Definition at line 395 of file qframe.cpp.
|
overridevirtual |
\reimp
Reimplemented from QWidget.
Reimplemented in SizeHinterFrame, SizeHinterFrame, QSplitter, QLCDNumber, and QLabel.
Definition at line 493 of file qframe.cpp.
|
readwrite |
the frame's rectangle
The frame's rectangle is the rectangle the frame is drawn in. By default, this is the entire widget. Setting the rectangle does does not cause a widget update. The frame rectangle is automatically adjusted when the widget changes size.
If you set the rectangle to a null rectangle (for example, QRect(0, 0, 0, 0)), then the resulting frame rectangle is equivalent to the \l{QWidget::rect()}{widget rectangle}.
|
readwrite |
the frame shadow value from the frame style
|
readwrite |
the frame shape value from the frame style
|
read |
the width of the frame that is drawn.
Note that the frame width depends on the \l{QFrame::setFrameStyle()}{frame style}, not only the line width and the mid-line width. For example, the style specified by \l NoFrame always has a frame width of 0, whereas the style \l Panel has a frame width equivalent to the line width.
|
readwrite |
the line width
Note that the total line width for frames used as separators (\l HLine and \l VLine) is specified by \l frameWidth.
The default value is 1.
|
readwrite |