Skip to content

PythonQt.QtGui.QStylePainter

QStylePainter

PythonQtInstanceWrapper object

Native bases: PythonQtInstanceWrapper

Supplemental documentation: Qt 5 reference:

Detailed Description

QStylePainter extends QPainter with a set of high-level draw...() functions implemented on top of QStyle's API. The advantage of using QStylePainter is that the parameter lists get considerably shorter. Whereas a QStyle object must be able to draw on any widget using any painter (because the application normally has one QStyle object shared by all widget), a QStylePainter is initialized with a widget, eliminating the need to specify the QWidget, the QPainter, and the QStyle for every function call.

Example using QStyle directly:

void MyWidget::paintEvent(QPaintEvent * /* event */)
{
    QPainter painter(this);

    QStyleOptionFocusRect option;
    option.initFrom(this);
    option.backgroundColor = palette().color(QPalette::Background);

    style()->drawPrimitive(QStyle::PE_FrameFocusRect, &option, &painter, this);
}

Example using QStylePainter:

void MyWidget::paintEvent(QPaintEvent * /* event */)
{
    QStylePainter painter(this);

    QStyleOptionFocusRect option;
    option.initFrom(this);
    option.backgroundColor = palette().color(QPalette::Background);

    painter.drawPrimitive(QStyle::PE_FrameFocusRect, option);
}

Source: https://doc.qt.io/archives/qt-5.15/qstylepainter.html

Complete member index

Every captured member retains its own identity. Identical captured declaration text is linked once; this does not establish native inheritance or interchangeable objects.

Member Kind Signature Summary
Antialiasing attribute Any (shared captured text)
CompositionMode attribute type Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text)
CompositionMode_Clear attribute Any (shared captured text)
CompositionMode_ColorBurn attribute Any (shared captured text)
CompositionMode_ColorDodge attribute Any (shared captured text)
CompositionMode_Darken attribute Any (shared captured text)
CompositionMode_Destination attribute Any (shared captured text)
CompositionMode_DestinationAtop attribute Any (shared captured text)
CompositionMode_DestinationIn attribute Any (shared captured text)
CompositionMode_DestinationOut attribute Any (shared captured text)
CompositionMode_DestinationOver attribute Any (shared captured text)
CompositionMode_Difference attribute Any (shared captured text)
CompositionMode_Exclusion attribute Any (shared captured text)
CompositionMode_HardLight attribute Any (shared captured text)
CompositionMode_Lighten attribute Any (shared captured text)
CompositionMode_Multiply attribute Any (shared captured text)
CompositionMode_Overlay attribute Any (shared captured text)
CompositionMode_Plus attribute Any (shared captured text)
CompositionMode_Screen attribute Any (shared captured text)
CompositionMode_SoftLight attribute Any (shared captured text)
CompositionMode_Source attribute Any (shared captured text)
CompositionMode_SourceAtop attribute Any (shared captured text)
CompositionMode_SourceIn attribute Any (shared captured text)
CompositionMode_SourceOut attribute Any (shared captured text)
CompositionMode_SourceOver attribute Any (shared captured text)
CompositionMode_Xor attribute Any (shared captured text)
HighQualityAntialiasing attribute Any (shared captured text)
NonCosmeticDefaultPen attribute Any (shared captured text)
OpaqueHint attribute Any (shared captured text)
PixmapFragmentHint attribute type Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text)
PixmapFragmentHints attribute type Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text)
Qt4CompatiblePainting attribute Any (shared captured text)
RasterOp_ClearDestination attribute Any (shared captured text)
RasterOp_NotDestination attribute Any (shared captured text)
RasterOp_NotSource attribute Any (shared captured text)
RasterOp_NotSourceAndDestination attribute Any (shared captured text)
RasterOp_NotSourceAndNotDestination attribute Any (shared captured text)
RasterOp_NotSourceOrDestination attribute Any (shared captured text)
RasterOp_NotSourceOrNotDestination attribute Any (shared captured text)
RasterOp_NotSourceXorDestination attribute Any (shared captured text)
RasterOp_SetDestination attribute Any (shared captured text)
RasterOp_SourceAndDestination attribute Any (shared captured text)
RasterOp_SourceAndNotDestination attribute Any (shared captured text)
RasterOp_SourceOrDestination attribute Any (shared captured text)
RasterOp_SourceOrNotDestination attribute Any (shared captured text)
RasterOp_SourceXorDestination attribute Any (shared captured text)
RenderHint attribute type Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text)
RenderHints attribute type Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text)
SmoothPixmapTransform attribute Any (shared captured text)
TextAntialiasing attribute Any (shared captured text)
__init__ function (self, *args: Any, **kwargs: Any) -> None Native constructor; consult class documentation for supported overloads. (shared captured text)
background function (self) -> Any X.background() -> PythonQt.QtGui.QBrush
backgroundMode function (self) -> Any
begin function (self, pd: Any, w: Any) -> bool X.begin(pd, w) -> bool
beginNativePainting function (self) -> Any
boundingRect function (self, x: Any, y: Any, w: Any, h: Any, arg4: flags, text: Any) -> Any X.boundingRect(x, y, w, h, flags, text) -> PythonQt.QtCore.QRect
brush function (self) -> Any X.brush() -> PythonQt.QtGui.QBrush (shared captured text)
brushOrigin function (self) -> Any X.brushOrigin() -> PythonQt.QtCore.QPoint
className function (self, *args: Any, **kwargs: Any) -> Any Return the classname of the object (shared captured text)
clipBoundingRect function (self) -> Any X.clipBoundingRect() -> PythonQt.QtCore.QRectF
clipPath function (self) -> Any X.clipPath() -> PythonQt.QtGui.QPainterPath (shared captured text)
clipRegion function (self) -> Any X.clipRegion() -> PythonQt.QtGui.QRegion
combinedMatrix function (self) -> Any X.combinedMatrix() -> PythonQt.QtGui.QMatrix
combinedTransform function (self) -> Any X.combinedTransform() -> PythonQt.QtGui.QTransform
compositionMode function (self) -> Any
delete function (self, *args: Any, **kwargs: Any) -> Any Deletes the C++ object (at your own risk, my friend!) (shared captured text)
device function (self) -> Any X.device() -> PythonQt.QtGui.QPaintDevice
deviceMatrix function (self) -> Any X.deviceMatrix() -> PythonQt.QtGui.QMatrix
deviceTransform function (self) -> Any X.deviceTransform() -> PythonQt.QtGui.QTransform
drawArc function (self, x: Any, y: Any, w: Any, h: Any, a: Any, alen: Any) -> Any X.drawArc(x, y, w, h, a, alen)
drawChord function (self, x: Any, y: Any, w: Any, h: Any, a: Any, alen: Any) -> Any X.drawChord(x, y, w, h, a, alen)
drawComplexControl function (self, cc: Any, opt: Any) -> None X.drawComplexControl(cc, opt)
drawControl function (self, ce: Any, opt: Any) -> None X.drawControl(ce, opt)
drawConvexPolygon function (self, polygon: Any) -> Any
drawEllipse function (self, x: Any, y: Any, w: Any, h: Any) -> Any X.drawEllipse(x, y, w, h)
drawGlyphRun function (self, position: Any, glyphRun: Any) -> Any X.drawGlyphRun(position, glyphRun)
drawImage function (self, x: Any, y: Any, image: Any, sx: Any, sy: Any, sw: Any, sh: Any, arg7: flags) -> Any X.drawImage(x, y, image, sx, sy, sw, sh, flags)
drawItemPixmap function (self, r: Any, arg1: flags, pixmap: Any) -> None X.drawItemPixmap(r, flags, pixmap)
drawItemText function (self, r: Any, arg1: flags, pal: Any, enabled: bool, text: str, textRole: Any) -> None X.drawItemText(r, flags, pal, enabled, text, textRole)
drawLine function (self, x1: Any, y1: Any, x2: Any, y2: Any) -> Any X.drawLine(x1, y1, x2, y2)
drawLines function (self, lines: Any) -> Any
drawPath function (self, path: Any) -> Any
drawPicture function (self, x: Any, y: Any, picture: Any) -> Any X.drawPicture(x, y, picture)
drawPie function (self, x: Any, y: Any, w: Any, h: Any, a: Any, alen: Any) -> Any X.drawPie(x, y, w, h, a, alen)
drawPixmap function (self, x: Any, y: Any, w: Any, h: Any, pm: Any, sx: Any, sy: Any, sw: Any, sh: Any) -> Any X.drawPixmap(x, y, w, h, pm, sx, sy, sw, sh)
drawPixmapFragments function (self, fragments: Any, fragmentCount: Any, pixmap: Any, hints: Any) -> Any X.drawPixmapFragments(fragments, fragmentCount, pixmap, hints)
drawPoint function (self, x: Any, y: Any) -> Any X.drawPoint(x, y)
drawPoints function (self, points: Any) -> Any
drawPolygon function (self, polygon: Any, fillRule: Any) -> Any X.drawPolygon(polygon, fillRule)
drawPolyline function (self, polygon: Any) -> Any
drawPrimitive function (self, pe: Any, opt: Any) -> None X.drawPrimitive(pe, opt)
drawRect function (self, x1: Any, y1: Any, w: Any, h: Any) -> Any X.drawRect(x1, y1, w, h)
drawRects function (self, rectangles: Any) -> Any
drawRoundRect function (self, x: Any, y: Any, w: Any, h: Any, arg__5: Any, arg__6: Any) -> Any X.drawRoundRect(x, y, w, h, arg__5, arg__6)
drawRoundedRect function (self, x: Any, y: Any, w: Any, h: Any, xRadius: Any, yRadius: Any, mode: Any) -> Any X.drawRoundedRect(x, y, w, h, xRadius, yRadius, mode)
drawStaticText function (self, left: Any, top: Any, staticText: Any) -> Any X.drawStaticText(left, top, staticText)
drawText function (self, x: Any, y: Any, w: Any, h: Any, arg4: flags, text: Any, br: Any) -> Any X.drawText(x, y, w, h, flags, text, br)
drawTextItem function (self, x: Any, y: Any, ti: Any) -> Any X.drawTextItem(x, y, ti)
drawTiledPixmap function (self, x: Any, y: Any, w: Any, h: Any, arg__5: Any, sx: Any, sy: Any) -> Any X.drawTiledPixmap(x, y, w, h, arg__5, sx, sy)
end function (self) -> bool X.end() -> bool
endNativePainting function (self) -> Any
eraseRect function (self, x: Any, y: Any, w: Any, h: Any) -> Any X.eraseRect(x, y, w, h)
fillPath function (self, path: Any, brush: Any) -> Any X.fillPath(path, brush)
fillRect function (self, x: Any, y: Any, w: Any, h: Any, style: Any) -> Any X.fillRect(x, y, w, h, style)
font function (self) -> Any X.font() -> PythonQt.QtGui.QFont
fontInfo function (self) -> Any X.fontInfo() -> PythonQt.QtGui.QFontInfo (shared captured text)
fontMetrics function (self) -> Any X.fontMetrics() -> PythonQt.QtGui.QFontMetrics (shared captured text)
hasClipping function (self) -> bool X.hasClipping() -> bool
help function (self, *args: Any, **kwargs: Any) -> Any Shows the help of available methods for this class (shared captured text)
inherits function (self, *args: Any, **kwargs: Any) -> Any Returns if the class inherits or is of given type name (shared captured text)
initFrom function (self, device: Any) -> Any
isActive function (self) -> bool X.isActive() -> bool (shared captured text)
layoutDirection function (self) -> Any
opacity function (self) -> float X.opacity() -> float (shared captured text)
paintEngine function (self) -> Any X.paintEngine() -> PythonQt.QtGui.QPaintEngine (shared captured text)
pen function (self) -> Any X.pen() -> PythonQt.QtGui.QPen (shared captured text)
redirected function (self, device: Any, offset: Any) -> Any X.redirected(device, offset) -> PythonQt.QtGui.QPaintDevice
renderHints function (self) -> Any
resetMatrix function (self) -> Any
resetTransform function (self) -> Any (shared captured text)
restore function (self) -> Any
restoreRedirected function (self, device: Any) -> Any
rotate function (self, a: Any) -> Any
save function (self) -> Any
scale function (self, sx: Any, sy: Any) -> Any X.scale(sx, sy)
setBackground function (self, bg: Any) -> Any
setBackgroundMode function (self, mode: Any) -> Any
setBrush function (self, brush: Any) -> Any (shared captured text)
setBrushOrigin function (self, x: Any, y: Any) -> Any X.setBrushOrigin(x, y)
setClipPath function (self, path: Any, op: Any) -> Any X.setClipPath(path, op)
setClipRect function (self, x: Any, y: Any, w: Any, h: Any, op: Any) -> Any X.setClipRect(x, y, w, h, op)
setClipRegion function (self, arg__1: Any, op: Any) -> Any X.setClipRegion(arg__1, op)
setClipping function (self, enable: Any) -> Any
setCompositionMode function (self, mode: Any) -> Any
setFont function (self, f: Any) -> Any
setLayoutDirection function (self, direction: Any) -> Any (shared captured text)
setOpacity function (self, opacity: Any) -> Any (shared captured text)
setPen function (self, style: Any) -> Any
setRedirected function (self, device: Any, replacement: Any, offset: Any) -> Any X.setRedirected(device, replacement, offset)
setRenderHint function (self, hint: Any, on: Any) -> Any X.setRenderHint(hint, on)
setRenderHints function (self, hints: Any, on: Any) -> Any X.setRenderHints(hints, on)
setTransform function (self, transform: Any, combine: Any) -> Any X.setTransform(transform, combine)
setViewTransformEnabled function (self, enable: Any) -> Any
setViewport function (self, x: Any, y: Any, w: Any, h: Any) -> Any X.setViewport(x, y, w, h)
setWindow function (self, x: Any, y: Any, w: Any, h: Any) -> Any X.setWindow(x, y, w, h)
setWorldMatrix function (self, matrix: Any, combine: Any) -> Any X.setWorldMatrix(matrix, combine)
setWorldMatrixEnabled function (self, enabled: Any) -> Any
setWorldTransform function (self, matrix: Any, combine: Any) -> Any X.setWorldTransform(matrix, combine)
shear function (self, sh: Any, sv: Any) -> Any X.shear(sh, sv)
strokePath function (self, path: Any, pen: Any) -> Any X.strokePath(path, pen)
style function (self) -> Any X.style() -> PythonQt.QtGui.QStyle
testRenderHint function (self, hint: Any) -> bool X.testRenderHint(hint) -> bool
transform function (self) -> Any X.transform() -> PythonQt.QtGui.QTransform (shared captured text)
translate function (self, dx: Any, dy: Any) -> Any X.translate(dx, dy)
viewTransformEnabled function (self) -> bool X.viewTransformEnabled() -> bool
viewport function (self) -> Any X.viewport() -> PythonQt.QtCore.QRect
window function (self) -> Any X.window() -> PythonQt.QtCore.QRect
worldMatrix function (self) -> Any X.worldMatrix() -> PythonQt.QtGui.QMatrix
worldMatrixEnabled function (self) -> bool X.worldMatrixEnabled() -> bool
worldTransform function (self) -> Any X.worldTransform() -> PythonQt.QtGui.QTransform