|  | Home · Overviews · Examples |

# QFrame Class Reference
[com.trolltech.qt.gui module]

The `QFrame` class is the base class of widgets that can have a frame. More...

Inherits `QWidget`.

Inherited by `QAbstractScrollArea`, `QLabel`, `QLCDNumber`, `QSplitter`, `QStackedWidget`, and `QToolBox`.

## Detailed Description

The `QFrame` class is the base class of widgets that can have a frame.

`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.

        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 placeholder frames without any contents.

The frame style is specified by a frame shape and a 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 `NoFrame`, Box, Panel, `StyledPanel`, `HLine` and `VLine`; the shadow styles are Plain, Raised and Sunken.

A frame widget has three attributes that describe the thickness of the border: `lineWidth`, `midLineWidth`, and `frameWidth`.

- The line width is the width of the frame border. It can be modified to customize the frame's appearance.
- 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.
- The frame width is determined by the frame style, and the `frameWidth` function is used to obtain the value defined for the style used.

The margin between the frame and the contents of the frame can be customized with the QWidget::setContentsMargins() function.

This table shows some of the combinations of styles and line widths: