QFrame¶

Inherited by: QChartView, QHelpContentWidget, QHelpIndexWidget, QAbstractItemView, QAbstractScrollArea, QColumnView, QGraphicsView, QHeaderView, QLCDNumber, QLabel, QListView, QListWidget, QMdiArea, QPlainTextEdit, QScrollArea, QSplitter, QStackedWidget, QTableView, QTableWidget, QTextBrowser, QTextEdit, QToolBox, QTreeView, QTreeWidget, QUndoView
Synopsis¶
Functions¶
def
drawFrame(arg__1)def
frameRect()def
frameShadow()def
frameShape()def
frameStyle()def
frameWidth()def
initStyleOption(option)def
lineWidth()def
midLineWidth()def
setFrameRect(arg__1)def
setFrameShadow(arg__1)def
setFrameShape(arg__1)def
setFrameStyle(arg__1)def
setLineWidth(arg__1)def
setMidLineWidth(arg__1)
Detailed Description¶
QMenuuses this to “raise” the menu above the surrounding screen.QProgressBarhas a “sunken” look.QLabelhas a flat look. The frames of widgets like these can be changed.label = QLabel() label.setFrameStyle(QFrame.Panel | QFrame.Raised) label.setLineWidth(2) pbar = QProgressBar() label.setFrameStyle(QFrame.NoFrame)The
QFrameclass can also be used directly for creating simple placeholder frames without any contents.The frame style is specified by a
frame shapeand ashadow stylethat is used to visually separate the frame from surrounding widgets. These properties can be set together using thesetFrameStyle()function and read withframeStyle().The frame shapes are
NoFrame,Box,Panel,StyledPanel,HLineandVLine; the shadow styles arePlain,RaisedandSunken.A frame widget has three attributes that describe the thickness of the border:
lineWidth,midLineWidth, andframeWidth.
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,HLineandVLineframes 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
setContentsMargins()function.This table shows some of the combinations of styles and line widths:
![]()
- class PySide2.QtWidgets.QFrame([parent=None[, f=Qt.WindowFlags()]])¶
- param f:
WindowFlags- param parent:
Constructs a frame widget with frame style
NoFrameand a 1-pixel frame width.The
parentandfarguments are passed to theQWidgetconstructor.
- PySide2.QtWidgets.QFrame.Shape¶
This enum type defines the shapes of frame available.
Constant
Description
QFrame.NoFrame
QFramedraws nothingQFrame.Box
QFramedraws a box around its contentsQFrame.Panel
QFramedraws a panel to make the contents appear raised or sunkenQFrame.StyledPanel
draws a rectangular panel with a look that depends on the current GUI style. It can be raised or sunken.
QFrame.HLine
QFramedraws a horizontal line that frames nothing (useful as separator)QFrame.VLine
QFramedraws a vertical line that frames nothing (useful as separator)QFrame.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. is provided for compatibility. For GUI style independence we recommend using instead.
When it does not call
QStyle, Shape interacts withShadow, thelineWidth()and themidLineWidth()to create the total result. See the picture of the frames in the main class documentation.See also
Shadowstyle()drawPrimitive()
- PySide2.QtWidgets.QFrame.Shadow¶
This enum type defines the types of shadow that are used to give a 3D effect to frames.
Constant
Description
QFrame.Plain
the frame and contents appear level with the surroundings; draws using the palette
WindowTextcolor (without any 3D effect)QFrame.Raised
the frame and contents appear raised; draws a 3D raised line using the light and dark colors of the current color group
QFrame.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
Shape, thelineWidth()and themidLineWidth(). See the picture of the frames in the main class documentation.See also
ShapelineWidth()midLineWidth()
- PySide2.QtWidgets.QFrame.StyleMask¶
This enum defines two constants that can be used to extract the two components of
frameStyle():Constant
Description
QFrame.Shadow_Mask
The
Shadowpart offrameStyle()QFrame.Shape_Mask
The
Shapepart offrameStyle()Normally, you don’t need to use these, since
frameShadow()andframeShape()already extract theShadowand theShapeparts offrameStyle().See also
- PySide2.QtWidgets.QFrame.drawFrame(arg__1)¶
- Parameters:
arg__1 –
PySide2.QtGui.QPainter
Used by
QLabelandQLCDNumber
- PySide2.QtWidgets.QFrame.frameRect()¶
- Return type:
This property holds 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 doesn’t 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 thewidget rectangle.
- PySide2.QtWidgets.QFrame.frameShadow()¶
- Return type:
This property holds the frame shadow value from the frame style.
See also
- PySide2.QtWidgets.QFrame.frameShape()¶
- Return type:
This property holds the frame shape value from the frame style.
See also
- PySide2.QtWidgets.QFrame.frameStyle()¶
- Return type:
int
Returns the frame style.
The default value is
Plain.See also
- PySide2.QtWidgets.QFrame.frameWidth()¶
- Return type:
int
This property holds the width of the frame that is drawn..
Note that the frame width depends on the
frame style, not only the line width and the mid-line width. For example, the style specified byNoFramealways has a frame width of 0, whereas the stylePanelhas a frame width equivalent to the line width.See also
- PySide2.QtWidgets.QFrame.initStyleOption(option)¶
- Parameters:
option –
PySide2.QtWidgets.QStyleOptionFrame
Initializes
optionwith the values from thisQFrame. This method is useful for subclasses when they need aQStyleOptionFramebut don’t want to fill in all the information themselves.See also
- PySide2.QtWidgets.QFrame.lineWidth()¶
- Return type:
int
This property holds the line width.
Note that the total line width for frames used as separators (
HLineandVLine) is specified byframeWidth.The default value is 1.
See also
- PySide2.QtWidgets.QFrame.midLineWidth()¶
- Return type:
int
This property holds the width of the mid-line.
The default value is 0.
See also
- PySide2.QtWidgets.QFrame.setFrameRect(arg__1)¶
- Parameters:
arg__1 –
PySide2.QtCore.QRect
This property holds 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 doesn’t 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 thewidget rectangle.
- PySide2.QtWidgets.QFrame.setFrameShadow(arg__1)¶
- Parameters:
arg__1 –
Shadow
This property holds the frame shadow value from the frame style.
See also
- PySide2.QtWidgets.QFrame.setFrameShape(arg__1)¶
- Parameters:
arg__1 –
Shape
This property holds the frame shape value from the frame style.
See also
- PySide2.QtWidgets.QFrame.setFrameStyle(arg__1)¶
- Parameters:
arg__1 – int
Sets the frame style to
style.The
styleis 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
Shapeand the shadow styles inShadow.If a mid-line width greater than 0 is specified, an additional line is drawn for
RaisedorSunkenBox,HLine, andVLineframes. The mid-color of the current color group is used for drawing middle lines.See also
- PySide2.QtWidgets.QFrame.setLineWidth(arg__1)¶
- Parameters:
arg__1 – int
This property holds the line width.
Note that the total line width for frames used as separators (
HLineandVLine) is specified byframeWidth.The default value is 1.
See also
- PySide2.QtWidgets.QFrame.setMidLineWidth(arg__1)¶
- Parameters:
arg__1 – int
This property holds the width of the mid-line.
The default value is 0.
See also
© 2022 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.