QtWidgets

The QtWidgets module contains classes that provide a set of UI elements to create classic desktop-style user interfaces.

Classes

QAbstractButton

QGraphicsItemGroup

QMainWindow

QStyleOptionHeader

QAbstractGraphicsShapeItem

QGraphicsLayout

QMdiArea

QStyleOptionHeaderV2

QAbstractItemDelegate

QGraphicsLayoutItem

QMdiSubWindow

QStyleOptionMenuItem

QAbstractItemView

QGraphicsLinearLayout

QMenu

QStyleOptionProgressBar

QAbstractScrollArea

QGraphicsLineItem

QMenuBar

QStyleOptionRubberBand

QAbstractSlider

QGraphicsObject

QMessageBox

QStyleOptionSizeGrip

QAbstractSpinBox

QGraphicsOpacityEffect

QPanGesture

QStyleOptionSlider

QApplication

QGraphicsPathItem

QPinchGesture

QStyleOptionSpinBox

QBoxLayout

QGraphicsPixmapItem

QPlainTextDocumentLayout

QStyleOptionTab

QButtonGroup

QGraphicsPolygonItem

QPlainTextEdit

QStyleOptionTabBarBase

QCalendarWidget

QGraphicsProxyWidget

QProgressBar

QStyleOptionTabWidgetFrame

QCheckBox

QGraphicsRectItem

QProgressDialog

QStyleOptionTitleBar

QColorDialog

QGraphicsRotation

QProxyStyle

QStyleOptionToolBar

QColumnView

QGraphicsScale

QPushButton

QStyleOptionToolBox

QComboBox

QGraphicsScene

QRadioButton

QStyleOptionToolButton

QCommandLinkButton

QGraphicsSceneContextMenuEvent

QRubberBand

QStyleOptionViewItem

QCommonStyle

QGraphicsSceneDragDropEvent

QScrollArea

QStylePainter

QCompleter

QGraphicsSceneEvent

QScrollBar

QSwipeGesture

QDataWidgetMapper

QGraphicsSceneHelpEvent

QScroller

QSystemTrayIcon

QDateEdit

QGraphicsSceneHoverEvent

QScrollerProperties

QTabBar

QDateTimeEdit

QGraphicsSceneMouseEvent

QSizeGrip

QTableView

QDial

QGraphicsSceneMoveEvent

QSizePolicy

QTableWidget

QDialog

QGraphicsSceneResizeEvent

QSlider

QTableWidgetItem

QDialogButtonBox

QGraphicsSceneWheelEvent

QSpacerItem

QTableWidgetSelectionRange

QDockWidget

QGraphicsSimpleTextItem

QSpinBox

QTabWidget

QDoubleSpinBox

QGraphicsTextItem

QSplashScreen

QTapAndHoldGesture

QErrorMessage

QGraphicsTransform

QSplitter

QTapGesture

QFileDialog

QGraphicsView

QSplitterHandle

QTextBrowser

QFileIconProvider

QGraphicsWidget

QStackedLayout

QTextEdit

QFocusFrame

QGridLayout

QStackedWidget

QTimeEdit

QFontComboBox

QGroupBox

QStatusBar

QToolBar

QFontDialog

QHBoxLayout

QStyle

QToolBox

QFormLayout

QHeaderView

QStyledItemDelegate

QToolButton

QFrame

QInputDialog

QStyleFactory

QToolTip

QGesture

QItemDelegate

QStyleHintReturn

QTreeView

QGestureEvent

QItemEditorCreatorBase

QStyleHintReturnMask

QTreeWidget

QGestureRecognizer

QItemEditorFactory

QStyleHintReturnVariant

QTreeWidgetItem

QGraphicsAnchor

QKeySequenceEdit

QStyleOption

QTreeWidgetItemIterator

QGraphicsAnchorLayout

QLabel

QStyleOptionButton

QUndoView

QGraphicsBlurEffect

QLayout

QStyleOptionComboBox

QVBoxLayout

QGraphicsColorizeEffect

QLayoutItem

QStyleOptionComplex

QWhatsThis

QGraphicsDropShadowEffect

QLCDNumber

QStyleOptionDockWidget

QWidget

QGraphicsEffect

QLineEdit

QStyleOptionFocusRect

QWidgetAction

QGraphicsEllipseItem

QListView

QStyleOptionFrame

QWidgetItem

QGraphicsGridLayout

QListWidget

QStyleOptionGraphicsItem

QWizard

QGraphicsItem

QListWidgetItem

QStyleOptionGroupBox

QWizardPage

Attributes

QWIDGETSIZE_MAX: int

This is a read-only attribute.

Defines the maximum size for a QWidget object.

The largest allowed size for a widget is QSize(, ), i.e. QSize (16777215,16777215).

See also

setMaximumSize().

Functions

qDrawBorderPixmap(QPainter, QRect, QMargins, QPixmap)

The qDrawBorderPixmap function is for drawing a pixmap into the margins of a rectangle.

Draws the given pixmap into the given target rectangle, using the given painter. The pixmap will be split into nine segments and drawn according to the margins structure.


qDrawPlainRect(QPainter, QRect, Union[QColor, GlobalColor, int], lineWidth: int = 1, fill: Union[QBrush, Union[QColor, GlobalColor, int], QGradient] = None)

Draws the plain rectangle specified by rect using the given painter, lineColor and lineWidth. The rectangle’s interior is filled with the fill brush unless fill is nullptr.

Warning: This function does not look at style() or style(). Use the drawing functions in QStyle to make widgets that follow the current GUI style.

Alternatively you can use a QFrame widget and apply the setFrameStyle() function to display a plain rectangle:

# QFrame frame:
# frame.setFrameStyle(QFrame::Box | QFrame::Plain);

qDrawPlainRect(QPainter, int, int, int, int, Union[QColor, GlobalColor, int], lineWidth: int = 1, fill: Union[QBrush, Union[QColor, GlobalColor, int], QGradient] = None)

Draws the plain rectangle beginning at (x, y) with the given width and height, using the specified painter, lineColor and lineWidth. The rectangle’s interior is filled with the fill brush unless fill is nullptr.

Warning: This function does not look at style() or style(). Use the drawing functions in QStyle to make widgets that follow the current GUI style.

Alternatively you can use a QFrame widget and apply the setFrameStyle() function to display a plain rectangle:

# QFrame frame:
# frame.setFrameStyle(QFrame::Box | QFrame::Plain);

qDrawPlainRoundedRect(QPainter, QRect, float, float, Union[QColor, GlobalColor, int], lineWidth: int = 1, fill: Union[QBrush, Union[QColor, GlobalColor, int], QGradient] = None)

Draws the plain rectangle specified by rect using the horizontal rx and vertical radius ry, the given painter, lineColor and lineWidth. The rectangle’s interior is filled with the fill brush unless fill is nullptr.

Warning: This function does not look at style() or style(). Use the drawing functions in QStyle to make widgets that follow the current GUI style.

Alternatively you can use a QFrame widget and apply the setFrameStyle() function to display a plain rectangle:

# QFrame frame:
# frame.setFrameStyle(QFrame::Box | QFrame::Plain);

qDrawPlainRoundedRect(QPainter, int, int, int, int, float, float, Union[QColor, GlobalColor, int], lineWidth: int = 1, fill: Union[QBrush, Union[QColor, GlobalColor, int], QGradient] = None)

Draws the plain rounded rectangle beginning at (x, y) with the given width and height, using the horizontal rx and vertical radius ry, specified painter, lineColor and lineWidth. The rectangle’s interior is filled with the fill brush unless fill is nullptr.

Warning: This function does not look at style() or style(). Use the drawing functions in QStyle to make widgets that follow the current GUI style.

Alternatively you can use a QFrame widget and apply the setFrameStyle() function to display a plain rectangle:

# QFrame frame:
# frame.setFrameStyle(QFrame::Box | QFrame::Plain);

qDrawShadeLine(QPainter, QPoint, QPoint, QPalette, sunken: bool = True, lineWidth: int = 1, midLineWidth: int = 0)

Draws a horizontal or vertical shaded line between p1 and p2 using the given painter. Note that nothing is drawn if the line between the points would be neither horizontal nor vertical.

The provided palette specifies the shading colors (light(), dark() and mid() colors). The given lineWidth specifies the line width for each of the lines; it is not the total line width. The given midLineWidth specifies the width of a middle line drawn in the mid() color.

The line appears sunken if sunken is true, otherwise raised.

Warning: This function does not look at style() or style(). Use the drawing functions in QStyle to make widgets that follow the current GUI style.

Alternatively you can use a QFrame widget and apply the setFrameStyle() function to display a shaded line:

# QFrame frame:
# frame.setFrameStyle(QFrame::HLine | QFrame::Sunken);

qDrawShadeLine(QPainter, int, int, int, int, QPalette, sunken: bool = True, lineWidth: int = 1, midLineWidth: int = 0)

Draws a horizontal (y1 == y2) or vertical (x1 == x2) shaded line using the given painter. Note that nothing is drawn if y1 != y2 and x1 != x2 (i.e. the line is neither horizontal nor vertical).

The provided palette specifies the shading colors (light(), dark() and mid() colors). The given lineWidth specifies the line width for each of the lines; it is not the total line width. The given midLineWidth specifies the width of a middle line drawn in the mid() color.

The line appears sunken if sunken is true, otherwise raised.

Warning: This function does not look at style() or style(). Use the drawing functions in QStyle to make widgets that follow the current GUI style.

Alternatively you can use a QFrame widget and apply the setFrameStyle() function to display a shaded line:

# QFrame frame:
# frame.setFrameStyle(QFrame::HLine | QFrame::Sunken);

qDrawShadePanel(QPainter, QRect, QPalette, sunken: bool = False, lineWidth: int = 1, fill: Union[QBrush, Union[QColor, GlobalColor, int], QGradient] = None)

Draws the shaded panel at the rectangle specified by rect using the given painter and the given lineWidth.

The given palette specifies the shading colors (light(), dark() and mid() colors). The panel’s interior is filled with the fill brush unless fill is nullptr.

The panel appears sunken if sunken is true, otherwise raised.

Warning: This function does not look at style() or style(). Use the drawing functions in QStyle to make widgets that follow the current GUI style.

Alternatively you can use a QFrame widget and apply the setFrameStyle() function to display a shaded panel:

# QFrame frame:
# frame.setFrameStyle( QFrame::Panel | QFrame::Sunken);

qDrawShadePanel(QPainter, int, int, int, int, QPalette, sunken: bool = False, lineWidth: int = 1, fill: Union[QBrush, Union[QColor, GlobalColor, int], QGradient] = None)

Draws the shaded panel beginning at (x, y) with the given width and height using the provided painter and the given lineWidth.

The given palette specifies the shading colors (light(), dark() and mid() colors). The panel’s interior is filled with the fill brush unless fill is nullptr.

The panel appears sunken if sunken is true, otherwise raised.

Warning: This function does not look at style() or style(). Use the drawing functions in QStyle to make widgets that follow the current GUI style.

Alternatively you can use a QFrame widget and apply the setFrameStyle() function to display a shaded panel:

# QFrame frame:
# frame.setFrameStyle( QFrame::Panel | QFrame::Sunken);

qDrawShadeRect(QPainter, QRect, QPalette, sunken: bool = False, lineWidth: int = 1, midLineWidth: int = 0, fill: Union[QBrush, Union[QColor, GlobalColor, int], QGradient] = None)

Draws the shaded rectangle specified by rect using the given painter.

The provide palette specifies the shading colors (light(), dark() and mid() colors. The given lineWidth specifies the line width for each of the lines; it is not the total line width. The midLineWidth specifies the width of a middle line drawn in the mid() color. The rectangle’s interior is filled with the fill brush unless fill is nullptr.

The rectangle appears sunken if sunken is true, otherwise raised.

Warning: This function does not look at style() or style(). Use the drawing functions in QStyle to make widgets that follow the current GUI style.

Alternatively you can use a QFrame widget and apply the setFrameStyle() function to display a shaded rectangle:

# QFrame frame:
# frame.setFrameStyle(QFrame::Box | QFrame::Raised);

qDrawShadeRect(QPainter, int, int, int, int, QPalette, sunken: bool = False, lineWidth: int = 1, midLineWidth: int = 0, fill: Union[QBrush, Union[QColor, GlobalColor, int], QGradient] = None)

Draws the shaded rectangle beginning at (x, y) with the given width and height using the provided painter.

The provide palette specifies the shading colors (light(), dark() and mid() colors. The given lineWidth specifies the line width for each of the lines; it is not the total line width. The midLineWidth specifies the width of a middle line drawn in the mid() color. The rectangle’s interior is filled with the fill brush unless fill is nullptr.

The rectangle appears sunken if sunken is true, otherwise raised.

Warning: This function does not look at style() or style(). Use the drawing functions in QStyle to make widgets that follow the current GUI style.

Alternatively you can use a QFrame widget and apply the setFrameStyle() function to display a shaded rectangle:

# QFrame frame:
# frame.setFrameStyle(QFrame::Box | QFrame::Raised);

qDrawWinButton(QPainter, QRect, QPalette, sunken: bool = False, fill: Union[QBrush, Union[QColor, GlobalColor, int], QGradient] = None)

Draws the Windows-style button at the rectangle specified by rect using the given painter with a line width of 2 pixels. The button’s interior is filled with the fill brush unless fill is nullptr.

The given palette specifies the shading colors (light(), dark() and mid() colors).

The button appears sunken if sunken is true, otherwise raised.

Warning: This function does not look at style() or style()-> Use the drawing functions in QStyle to make widgets that follow the current GUI style.

See also

qDrawWinPanel(), QStyle.


qDrawWinButton(QPainter, int, int, int, int, QPalette, sunken: bool = False, fill: Union[QBrush, Union[QColor, GlobalColor, int], QGradient] = None)

Draws the Windows-style button specified by the given point (x, y}, width and height using the provided painter with a line width of 2 pixels. The button’s interior is filled with the fill brush unless fill is nullptr.

The given palette specifies the shading colors (light(), dark() and mid() colors).

The button appears sunken if sunken is true, otherwise raised.

Warning: This function does not look at style() or style()-> Use the drawing functions in QStyle to make widgets that follow the current GUI style.

See also

qDrawWinPanel(), QStyle.


qDrawWinPanel(QPainter, QRect, QPalette, sunken: bool = False, fill: Union[QBrush, Union[QColor, GlobalColor, int], QGradient] = None)

Draws the Windows-style panel at the rectangle specified by rect using the given painter with a line width of 2 pixels. The button’s interior is filled with the fill brush unless fill is nullptr.

The given palette specifies the shading colors. The panel appears sunken if sunken is true, otherwise raised.

Warning: This function does not look at style() or style(). Use the drawing functions in QStyle to make widgets that follow the current GUI style.

Alternatively you can use a QFrame widget and apply the setFrameStyle() function to display a shaded panel:

# QFrame frame:
# frame.setFrameStyle(QFrame::WinPanel | QFrame::Raised);

qDrawWinPanel(QPainter, int, int, int, int, QPalette, sunken: bool = False, fill: Union[QBrush, Union[QColor, GlobalColor, int], QGradient] = None)

Draws the Windows-style panel specified by the given point(x, y), width and height using the provided painter with a line width of 2 pixels. The button’s interior is filled with the fill brush unless fill is nullptr.

The given palette specifies the shading colors. The panel appears sunken if sunken is true, otherwise raised.

Warning: This function does not look at style() or style(). Use the drawing functions in QStyle to make widgets that follow the current GUI style.

Alternatively you can use a QFrame widget and apply the setFrameStyle() function to display a shaded panel:

# QFrame frame:
# frame.setFrameStyle(QFrame::WinPanel | QFrame::Raised);