Skip to content

PythonQt.QtGui.QPainter · declarations 002

Back to PythonQt.QtGui.QPainter

RasterOp_SetDestination instance-attribute

RasterOp_SetDestination: Any

RasterOp_SourceAndDestination instance-attribute

RasterOp_SourceAndDestination: Any

RasterOp_SourceAndNotDestination instance-attribute

RasterOp_SourceAndNotDestination: Any

RasterOp_SourceOrDestination instance-attribute

RasterOp_SourceOrDestination: Any

RasterOp_SourceOrNotDestination instance-attribute

RasterOp_SourceOrNotDestination: Any

RasterOp_SourceXorDestination instance-attribute

RasterOp_SourceXorDestination: Any

RenderHint instance-attribute

RenderHint: type

int([x]) -> integer int(x, base=10) -> integer

Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.int(). For floating point numbers, this truncates towards zero.

If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal.

int('0b100', base=0) 4

RenderHints instance-attribute

RenderHints: type

int([x]) -> integer int(x, base=10) -> integer

Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.int(). For floating point numbers, this truncates towards zero.

If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal.

int('0b100', base=0) 4

SmoothPixmapTransform instance-attribute

SmoothPixmapTransform: Any

TextAntialiasing instance-attribute

TextAntialiasing: Any

background

background() -> Any

X.background() -> PythonQt.QtGui.QBrush

Supplemental documentation: Qt 5 reference:

const QBrush \&QPainter::background() const

Returns the current background brush.

See also setBackground() and Settings.

Upstream PySide2 reference signatures (binding differences may apply):

background(self) -> PySide2.QtGui.QBrush

Source: https://doc.qt.io/archives/qt-5.15/qpainter.html#background

backgroundMode

backgroundMode() -> Any

X.backgroundMode()

Supplemental documentation: Qt 5 reference:

Qt::BGMode QPainter::backgroundMode() const

Returns the current background mode.

See also setBackgroundMode() and Settings.

Upstream PySide2 reference signatures (binding differences may apply):

backgroundMode(self) -> PySide2.QtCore.Qt.BGMode

Source: https://doc.qt.io/archives/qt-5.15/qpainter.html#backgroundMode

begin

begin(arg__1: Any) -> bool

X.begin(arg__1) -> bool

Supplemental documentation: Qt 5 reference:

bool QPainter::begin(QPaintDevice *device)

Begins painting the paint device and returns true if successful; otherwise returns false.

Notice that all painter settings (setPen(), setBrush() etc.) are reset to default values when begin() is called.

The errors that can occur are serious problems, such as these:

painter->begin(0); // impossible - paint device cannot be 0

QPixmap image(0, 0);
painter->begin(&image); // impossible - image.isNull() == true;

painter->begin(myWidget);
painter2->begin(myWidget); // impossible - only one painter at a time

Note that most of the time, you can use one of the constructors instead of begin(), and that end() is automatically done at destruction.

Warning: A paint device can only be painted by one painter at a time.

Warning: Painting on a QImage with the format QImage::Format_Indexed8 is not supported.

See also end() and QPainter().

Upstream PySide2 reference signatures (binding differences may apply):

begin(self, arg__1: PySide2.QtGui.QPaintDevice) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qpainter.html#begin

beginNativePainting

beginNativePainting() -> None

X.beginNativePainting()

Supplemental documentation: Qt 5 reference:

void QPainter::beginNativePainting()

Flushes the painting pipeline and prepares for the user issuing commands directly to the underlying graphics context. Must be followed by a call to endNativePainting().

Note that only the states the underlying paint engine changes will be reset to their respective default states. The states we reset may change from release to release. The following states are currently reset in the OpenGL 2 engine:

  • blending is disabled
  • the depth, stencil and scissor tests are disabled
  • the active texture unit is reset to 0
  • the depth mask, depth function and the clear depth are reset to their default values
  • the stencil mask, stencil operation and stencil function are reset to their default values
  • the current color is reset to solid white

If, for example, the OpenGL polygon mode is changed by the user inside a beginNativePaint()/endNativePainting() block, it will not be reset to the default state by endNativePainting(). Here is an example that shows intermixing of painter commands and raw OpenGL commands:

QPainter painter(this);
painter.fillRect(0, 0, 128, 128, Qt::green);
painter.beginNativePainting();

glEnable(GL_SCISSOR_TEST);
glScissor(0, 0, 64, 64);

glClearColor(1, 0, 0, 1);
glClear(GL_COLOR_BUFFER_BIT);

glDisable(GL_SCISSOR_TEST);

painter.endNativePainting();

This function was introduced in Qt 4.6.

See also endNativePainting().

Upstream PySide2 reference signatures (binding differences may apply):

beginNativePainting(self) -> None

Source: https://doc.qt.io/archives/qt-5.15/qpainter.html#beginNativePainting

boundingRect

boundingRect(x: Any, y: Any, w: Any, h: Any, arg4: flags, text: str) -> Any

X.boundingRect(x, y, w, h, flags, text) -> PythonQt.QtCore.QRect

Supplemental documentation: Qt 5 reference:

QRectF QPainter::boundingRect(const QRectF \&rectangle, int flags, const QString \&text)

Returns the bounding rectangle of the text as it will appear when drawn inside the given rectangle with the specified flags using the currently set font(); i.e the function tells you where the drawText() function will draw when given the same arguments.

If the text does not fit within the given rectangle using the specified flags, the function returns the required rectangle.

The flags argument is a bitwise OR of the following flags:

If several of the horizontal or several of the vertical alignment flags are set, the resulting alignment is undefined.

See also drawText(), Qt::Alignment, and Qt::TextFlag.

QRect QPainter::boundingRect(const QRect \&rectangle, int flags, const QString \&text)

This is an overloaded function.

Returns the bounding rectangle of the text as it will appear when drawn inside the given rectangle with the specified flags using the currently set font().

QRect QPainter::boundingRect(int x, int y, int w, int h, int flags, const QString \&text)

This is an overloaded function.

Returns the bounding rectangle of the given text as it will appear when drawn inside the rectangle beginning at the point (x, y) with width w and height h.

QRectF QPainter::boundingRect(const QRectF \&rectangle, const QString \&text, const QTextOption \&option \= QTextOption())

This is an overloaded function.

Instead of specifying flags as a bitwise OR of the Qt::AlignmentFlag and Qt::TextFlag, this overloaded function takes an option argument. The QTextOption class provides a description of general rich text properties.

See also QTextOption.

Upstream PySide2 reference signatures (binding differences may apply):

boundingRect(self, rect: PySide2.QtCore.QRect, flags: int, text: str) -> PySide2.QtCore.QRect
boundingRect(self, rect: PySide2.QtCore.QRectF, flags: int, text: str) -> PySide2.QtCore.QRectF
boundingRect(self, rect: PySide2.QtCore.QRectF, text: str, o: PySide2.QtGui.QTextOption=...) -> PySide2.QtCore.QRectF
boundingRect(self, x: int, y: int, w: int, h: int, flags: int, text: str) -> PySide2.QtCore.QRect

Source: https://doc.qt.io/archives/qt-5.15/qpainter.html#boundingRect

brush

brush() -> Any

X.brush() -> PythonQt.QtGui.QBrush

Supplemental documentation: Qt 5 reference:

const QBrush \&QPainter::brush() const

Returns the painter's current brush.

See also QPainter::setBrush() and Settings.

Upstream PySide2 reference signatures (binding differences may apply):

brush(self) -> PySide2.QtGui.QBrush

Source: https://doc.qt.io/archives/qt-5.15/qpainter.html#brush

brushOrigin

brushOrigin() -> Any

X.brushOrigin() -> PythonQt.QtCore.QPoint

Supplemental documentation: Qt 5 reference:

QPoint QPainter::brushOrigin() const

Returns the currently set brush origin.

See also setBrushOrigin() and Settings.

Upstream PySide2 reference signatures (binding differences may apply):

brushOrigin(self) -> PySide2.QtCore.QPoint

Source: https://doc.qt.io/archives/qt-5.15/qpainter.html#brushOrigin

clipBoundingRect

clipBoundingRect() -> Any

X.clipBoundingRect() -> PythonQt.QtCore.QRectF

Supplemental documentation: Qt 5 reference:

QRectF QPainter::clipBoundingRect() const

Returns the bounding rectangle of the current clip if there is a clip; otherwise returns an empty rectangle. Note that the clip region is given in logical coordinates.

The bounding rectangle is not guaranteed to be tight.

This function was introduced in Qt 4.8.

See also setClipRect(), setClipPath(), and setClipRegion().

Upstream PySide2 reference signatures (binding differences may apply):

clipBoundingRect(self) -> PySide2.QtCore.QRectF

Source: https://doc.qt.io/archives/qt-5.15/qpainter.html#clipBoundingRect

clipPath

clipPath() -> Any

X.clipPath() -> PythonQt.QtGui.QPainterPath

Supplemental documentation: Qt 5 reference:

QPainterPath QPainter::clipPath() const

Returns the current clip path in logical coordinates.

Warning: QPainter does not store the combined clip explicitly as this is handled by the underlying QPaintEngine, so the path is recreated on demand and transformed to the current logical coordinate system. This is potentially an expensive operation.

See also setClipPath(), clipRegion(), and setClipping().

Upstream PySide2 reference signatures (binding differences may apply):

clipPath(self) -> PySide2.QtGui.QPainterPath

Source: https://doc.qt.io/archives/qt-5.15/qpainter.html#clipPath

clipRegion

clipRegion() -> Any

X.clipRegion() -> PythonQt.QtGui.QRegion

Supplemental documentation: Qt 5 reference:

QRegion QPainter::clipRegion() const

Returns the currently set clip region. Note that the clip region is given in logical coordinates.

Warning: QPainter does not store the combined clip explicitly as this is handled by the underlying QPaintEngine, so the path is recreated on demand and transformed to the current logical coordinate system. This is potentially an expensive operation.

See also setClipRegion(), clipPath(), and setClipping().

Upstream PySide2 reference signatures (binding differences may apply):

clipRegion(self) -> PySide2.QtGui.QRegion

Source: https://doc.qt.io/archives/qt-5.15/qpainter.html#clipRegion

combinedMatrix

combinedMatrix() -> Any

X.combinedMatrix() -> PythonQt.QtGui.QMatrix

Upstream PySide2 reference signatures (binding differences may apply):

combinedMatrix(self) -> PySide2.QtGui.QMatrix

Source: https://doc.qt.io/archives/qt-5.15/qpainter.html#combinedMatrix

combinedTransform

combinedTransform() -> Any

X.combinedTransform() -> PythonQt.QtGui.QTransform

Supplemental documentation: Qt 5 reference:

QTransform QPainter::combinedTransform() const

Returns the transformation matrix combining the current window/viewport and world transformation.

See also setWorldTransform(), setWindow(), and setViewport().

Upstream PySide2 reference signatures (binding differences may apply):

combinedTransform(self) -> PySide2.QtGui.QTransform

Source: https://doc.qt.io/archives/qt-5.15/qpainter.html#combinedTransform

compositionMode

compositionMode() -> Any

X.compositionMode()

Supplemental documentation: Qt 5 reference:

QPainter::CompositionMode QPainter::compositionMode() const

Returns the current composition mode.

See also CompositionMode and setCompositionMode().

Upstream PySide2 reference signatures (binding differences may apply):

compositionMode(self) -> PySide2.QtGui.QPainter.CompositionMode

Source: https://doc.qt.io/archives/qt-5.15/qpainter.html#compositionMode

device

device() -> Any

X.device() -> PythonQt.QtGui.QPaintDevice

Supplemental documentation: Qt 5 reference:

QPaintDevice *QPainter::device() const

Returns the paint device on which this painter is currently painting, or nullptr if the painter is not active.

See also isActive().

Upstream PySide2 reference signatures (binding differences may apply):

device(self) -> PySide2.QtGui.QPaintDevice

Source: https://doc.qt.io/archives/qt-5.15/qpainter.html#device

deviceMatrix

deviceMatrix() -> Any

X.deviceMatrix() -> PythonQt.QtGui.QMatrix

Upstream PySide2 reference signatures (binding differences may apply):

deviceMatrix(self) -> PySide2.QtGui.QMatrix

Source: https://doc.qt.io/archives/qt-5.15/qpainter.html#deviceMatrix

deviceTransform

deviceTransform() -> Any

X.deviceTransform() -> PythonQt.QtGui.QTransform

Supplemental documentation: Qt 5 reference:

const QTransform \&QPainter::deviceTransform() const

Returns the matrix that transforms from logical coordinates to device coordinates of the platform dependent paint device.

This function is only needed when using platform painting commands on the platform dependent handle (Qt::HANDLE), and the platform does not do transformations nativly.

The QPaintEngine::PaintEngineFeature enum can be queried to determine whether the platform performs the transformations or not.

See also worldTransform() and QPaintEngine::hasFeature().

Upstream PySide2 reference signatures (binding differences may apply):

deviceTransform(self) -> PySide2.QtGui.QTransform

Source: https://doc.qt.io/archives/qt-5.15/qpainter.html#deviceTransform

drawArc

drawArc(x: Any, y: Any, w: Any, h: Any, a: int, alen: int) -> None

X.drawArc(x, y, w, h, a, alen)

Supplemental documentation: Qt 5 reference:

void QPainter::drawArc(const QRectF \&rectangle, int startAngle, int spanAngle)

Draws the arc defined by the given rectangle, startAngle and spanAngle.

The startAngle and spanAngle must be specified in 1/16th of a degree, i.e. a full circle equals 5760 (16 * 360). Positive values for the angles mean counter-clockwise while negative values mean the clockwise direction. Zero degrees is at the 3 o'clock position.

QRectF rectangle(10.0, 20.0, 80.0, 60.0); int startAngle = 30 * 16; int spanAngle = 120 * 16; QPainter painter(this); painter.drawArc(rectangle, startAngle, spanAngle);

See also drawPie(), drawChord(), and Coordinate System.

void QPainter::drawArc(const QRect \&rectangle, int startAngle, int spanAngle)

This is an overloaded function.

Draws the arc defined by the given rectangle, startAngle and spanAngle.

void QPainter::drawArc(int x, int y, int width, int height, int startAngle, int spanAngle)

This is an overloaded function.

Draws the arc defined by the rectangle beginning at (x, y) with the specified width and height, and the given startAngle and spanAngle.

Upstream PySide2 reference signatures (binding differences may apply):

drawArc(self, arg__1: PySide2.QtCore.QRect, a: int, alen: int) -> None
drawArc(self, rect: PySide2.QtCore.QRectF, a: int, alen: int) -> None
drawArc(self, x: int, y: int, w: int, h: int, a: int, alen: int) -> None

Source: https://doc.qt.io/archives/qt-5.15/qpainter.html#drawArc

drawChord

drawChord(x: Any, y: Any, w: Any, h: Any, a: int, alen: int) -> None

X.drawChord(x, y, w, h, a, alen)

Supplemental documentation: Qt 5 reference:

void QPainter::drawChord(const QRectF \&rectangle, int startAngle, int spanAngle)

Draws the chord defined by the given rectangle, startAngle and spanAngle. The chord is filled with the current brush().

The startAngle and spanAngle must be specified in 1/16th of a degree, i.e. a full circle equals 5760 (16 * 360). Positive values for the angles mean counter-clockwise while negative values mean the clockwise direction. Zero degrees is at the 3 o'clock position.

QRectF rectangle(10.0, 20.0, 80.0, 60.0); int startAngle = 30 * 16; int spanAngle = 120 * 16; QPainter painter(this); painter.drawChord(rect, startAngle, spanAngle);

See also drawArc(), drawPie(), and Coordinate System.

void QPainter::drawChord(int x, int y, int width, int height, int startAngle, int spanAngle)

This is an overloaded function.

Draws the chord defined by the rectangle beginning at (x, y) with the specified width and height, and the given startAngle and spanAngle.

void QPainter::drawChord(const QRect \&rectangle, int startAngle, int spanAngle)

This is an overloaded function.

Draws the chord defined by the given rectangle, startAngle and spanAngle.

Upstream PySide2 reference signatures (binding differences may apply):

drawChord(self, arg__1: PySide2.QtCore.QRect, a: int, alen: int) -> None
drawChord(self, rect: PySide2.QtCore.QRectF, a: int, alen: int) -> None
drawChord(self, x: int, y: int, w: int, h: int, a: int, alen: int) -> None

Source: https://doc.qt.io/archives/qt-5.15/qpainter.html#drawChord

drawConvexPolygon

drawConvexPolygon(polygon: Any) -> None

X.drawConvexPolygon(polygon)

Supplemental documentation: Qt 5 reference:

void QPainter::drawConvexPolygon(const QPointF *points, int pointCount)

Draws the convex polygon defined by the first pointCount points in the array points using the current pen.

static const QPointF points[4] = { QPointF(10.0, 80.0), QPointF(20.0, 10.0), QPointF(80.0, 30.0), QPointF(90.0, 70.0) }; QPainter painter(this); painter.drawConvexPolygon(points, 4);

The first point is implicitly connected to the last point, and the polygon is filled with the current brush(). If the supplied polygon is not convex, i.e. it contains at least one angle larger than 180 degrees, the results are undefined.

On some platforms (e.g. X11), the drawConvexPolygon() function can be faster than the drawPolygon() function.

See also drawPolygon(), drawPolyline(), and Coordinate System.

void QPainter::drawConvexPolygon(const QPolygonF \&polygon)

This is an overloaded function.

Draws the convex polygon defined by polygon using the current pen and brush.

void QPainter::drawConvexPolygon(const QPoint *points, int pointCount)

This is an overloaded function.

Draws the convex polygon defined by the first pointCount points in the array points using the current pen.

void QPainter::drawConvexPolygon(const QPolygon \&polygon)

This is an overloaded function.

Draws the convex polygon defined by polygon using the current pen and brush.

Upstream PySide2 reference signatures (binding differences may apply):

drawConvexPolygon(self, arg__1: typing.List[PySide2.QtCore.QPointF]) -> None
drawConvexPolygon(self, arg__1: typing.List[PySide2.QtCore.QPoint]) -> None
drawConvexPolygon(self, polygon: PySide2.QtGui.QPolygon) -> None
drawConvexPolygon(self, polygon: PySide2.QtGui.QPolygonF) -> None

Source: https://doc.qt.io/archives/qt-5.15/qpainter.html#drawConvexPolygon

drawEllipse

drawEllipse(x: Any, y: Any, w: Any, h: Any) -> None

X.drawEllipse(x, y, w, h)

Supplemental documentation: Qt 5 reference:

void QPainter::drawEllipse(const QRectF \&rectangle)

Draws the ellipse defined by the given rectangle.

A filled ellipse has a size of rectangle.size(). A stroked ellipse has a size of rectangle.size() plus the pen width.

QRectF rectangle(10.0, 20.0, 80.0, 60.0); QPainter painter(this); painter.drawEllipse(rectangle);

See also drawPie() and Coordinate System.

void QPainter::drawEllipse(const QRect \&rectangle)

This is an overloaded function.

Draws the ellipse defined by the given rectangle.

void QPainter::drawEllipse(int x, int y, int width, int height)

This is an overloaded function.

Draws the ellipse defined by the rectangle beginning at (x, y) with the given width and height.

void QPainter::drawEllipse(const QPointF \&center, qreal rx, qreal ry)

This is an overloaded function.

Draws the ellipse positioned at center with radii rx and ry.

This function was introduced in Qt 4.4.

void QPainter::drawEllipse(const QPoint \&center, int rx, int ry)

This is an overloaded function.

Draws the ellipse positioned at center with radii rx and ry.

This function was introduced in Qt 4.4.

Upstream PySide2 reference signatures (binding differences may apply):

drawEllipse(self, center: PySide2.QtCore.QPoint, rx: int, ry: int) -> None
drawEllipse(self, center: PySide2.QtCore.QPointF, rx: float, ry: float) -> None
drawEllipse(self, r: PySide2.QtCore.QRect) -> None
drawEllipse(self, r: PySide2.QtCore.QRectF) -> None
drawEllipse(self, x: int, y: int, w: int, h: int) -> None

Source: https://doc.qt.io/archives/qt-5.15/qpainter.html#drawEllipse

drawGlyphRun

drawGlyphRun(position: Any, glyphRun: Any) -> Any

X.drawGlyphRun(position, glyphRun)

Supplemental documentation: Qt 5 reference:

void QPainter::drawGlyphRun(const QPointF \&position, const QGlyphRun \&glyphs)

Draws the glyphs represented by glyphs at position. The position gives the edge of the baseline for the string of glyphs. The glyphs will be retrieved from the font selected on glyphs and at offsets given by the positions in glyphs.

This function was introduced in Qt 4.8.

See also QGlyphRun::setRawFont(), QGlyphRun::setPositions(), and QGlyphRun::setGlyphIndexes().

Source: https://doc.qt.io/archives/qt-5.15/qpainter.html#drawGlyphRun

drawImage

drawImage(x: Any, y: Any, image: Any, sx: Any, sy: Any, sw: Any, sh: Any, arg7: flags) -> None

X.drawImage(x, y, image, sx, sy, sw, sh, flags)

Supplemental documentation: Qt 5 reference:

void QPainter::drawImage(const QRectF \&target, const QImage \&image, const QRectF \&source, Qt::ImageConversionFlags flags \= Qt::AutoColor)

Draws the rectangular portion source of the given image into the target rectangle in the paint device.

Note: The image is scaled to fit the rectangle, if both the image and rectangle size disagree.

Note: See Drawing High Resolution Versions of Pixmaps and Images on how this is affected by QImage::devicePixelRatio().

If the image needs to be modified to fit in a lower-resolution result (e.g. converting from 32-bit to 8-bit), use the flags to specify how you would prefer this to happen.

QRectF target(10.0, 20.0, 80.0, 60.0); QRectF source(0.0, 0.0, 70.0, 40.0); QImage image(":/images/myImage.png"); QPainter painter(this); painter.drawImage(target, image, source);

See also drawPixmap() and QImage::devicePixelRatio().

void QPainter::drawImage(const QRect \&target, const QImage \&image, const QRect \&source, Qt::ImageConversionFlags flags \= Qt::AutoColor)

This is an overloaded function.

Draws the rectangular portion source of the given image into the target rectangle in the paint device.

Note: The image is scaled to fit the rectangle, if both the image and rectangle size disagree.

void QPainter::drawImage(const QPointF \&point, const QImage \&image, const QRectF \&source, Qt::ImageConversionFlags flags \= Qt::AutoColor)

This is an overloaded function.

Draws the rectangular portion source of the given image with its origin at the given point.

void QPainter::drawImage(const QPoint \&point, const QImage \&image, const QRect \&source, Qt::ImageConversionFlags flags \= Qt::AutoColor)

This is an overloaded function.

Draws the rectangular portion source of the given image with its origin at the given point.

void QPainter::drawImage(const QRectF \&rectangle, const QImage \&image)

This is an overloaded function.

Draws the given image into the given rectangle.

Note: The image is scaled to fit the rectangle, if both the image and rectangle size disagree.

void QPainter::drawImage(const QRect \&rectangle, const QImage \&image)

This is an overloaded function.

Draws the given image into the given rectangle.

Note: The image is scaled to fit the rectangle, if both the image and rectangle size disagree.

void QPainter::drawImage(const QPointF \&point, const QImage \&image)

This is an overloaded function.

Draws the given image at the given point.

void QPainter::drawImage(const QPoint \&point, const QImage \&image)

This is an overloaded function.

Draws the given image at the given point.

void QPainter::drawImage(int x, int y, const QImage \&image, int sx \= 0, int sy \= 0, int sw \= -1, int sh \= -1, Qt::ImageConversionFlags flags \= Qt::AutoColor)

This is an overloaded function.

Draws an image at (x, y) by copying a part of image into the paint device.

(x, y) specifies the top-left point in the paint device that is to be drawn onto. (sx, sy) specifies the top-left point in image that is to be drawn. The default is (0, 0).

(sw, sh) specifies the size of the image that is to be drawn. The default, (0, 0) (and negative) means all the way to the bottom-right of the image.

Upstream PySide2 reference signatures (binding differences may apply):

drawImage(self, p: PySide2.QtCore.QPoint, image: PySide2.QtGui.QImage) -> None
drawImage(self, p: PySide2.QtCore.QPoint, image: PySide2.QtGui.QImage, sr: PySide2.QtCore.QRect, flags: PySide2.QtCore.Qt.ImageConversionFlags=...) -> None
drawImage(self, p: PySide2.QtCore.QPointF, image: PySide2.QtGui.QImage) -> None
drawImage(self, p: PySide2.QtCore.QPointF, image: PySide2.QtGui.QImage, sr: PySide2.QtCore.QRectF, flags: PySide2.QtCore.Qt.ImageConversionFlags=...) -> None
drawImage(self, r: PySide2.QtCore.QRect, image: PySide2.QtGui.QImage) -> None
drawImage(self, r: PySide2.QtCore.QRectF, image: PySide2.QtGui.QImage) -> None
drawImage(self, targetRect: PySide2.QtCore.QRect, image: PySide2.QtGui.QImage, sourceRect: PySide2.QtCore.QRect, flags: PySide2.QtCore.Qt.ImageConversionFlags=...) -> None
drawImage(self, targetRect: PySide2.QtCore.QRectF, image: PySide2.QtGui.QImage, sourceRect: PySide2.QtCore.QRectF, flags: PySide2.QtCore.Qt.ImageConversionFlags=...) -> None
drawImage(self, x: int, y: int, image: PySide2.QtGui.QImage, sx: int=..., sy: int=..., sw: int=..., sh: int=..., flags: PySide2.QtCore.Qt.ImageConversionFlags=...) -> None

Source: https://doc.qt.io/archives/qt-5.15/qpainter.html#drawImage

drawLine

drawLine(x1: Any, y1: Any, x2: Any, y2: Any) -> None

X.drawLine(x1, y1, x2, y2)

Supplemental documentation: Qt 5 reference:

void QPainter::drawLine(const QLineF \&line)

Draws a line defined by line.

QLineF line(10.0, 80.0, 90.0, 20.0); QPainter(this); painter.drawLine(line);

See also drawLines(), drawPolyline(), and Coordinate System.

void QPainter::drawLine(const QLine \&line)

This is an overloaded function.

Draws a line defined by line.

void QPainter::drawLine(int x1, int y1, int x2, int y2)

This is an overloaded function.

Draws a line from (x1, y1) to (x2, y2).

void QPainter::drawLine(const QPoint \&p1, const QPoint \&p2)

This is an overloaded function.

Draws a line from p1 to p2.

void QPainter::drawLine(const QPointF \&p1, const QPointF \&p2)

This is an overloaded function.

Draws a line from p1 to p2.

Upstream PySide2 reference signatures (binding differences may apply):

drawLine(self, line: PySide2.QtCore.QLine) -> None
drawLine(self, line: PySide2.QtCore.QLineF) -> None
drawLine(self, p1: PySide2.QtCore.QPoint, p2: PySide2.QtCore.QPoint) -> None
drawLine(self, p1: PySide2.QtCore.QPointF, p2: PySide2.QtCore.QPointF) -> None
drawLine(self, x1: int, y1: int, x2: int, y2: int) -> None

Source: https://doc.qt.io/archives/qt-5.15/qpainter.html#drawLine

drawLines

drawLines(lines: Any) -> None

X.drawLines(lines)

Supplemental documentation: Qt 5 reference:

void QPainter::drawLines(const QLineF *lines, int lineCount)

Draws the first lineCount lines in the array lines using the current pen.

See also drawLine() and drawPolyline().

void QPainter::drawLines(const QVector\<QLineF> \&lines)

This is an overloaded function.

Draws the set of lines defined by the list lines using the current pen and brush.

void QPainter::drawLines(const QPointF *pointPairs, int lineCount)

This is an overloaded function.

Draws the first lineCount lines in the array pointPairs using the current pen. The lines are specified as pairs of points so the number of entries in pointPairs must be at least lineCount * 2.

void QPainter::drawLines(const QVector\<QPointF> \&pointPairs)

This is an overloaded function.

Draws a line for each pair of points in the vector pointPairs using the current pen. If there is an odd number of points in the array, the last point will be ignored.

void QPainter::drawLines(const QLine *lines, int lineCount)

This is an overloaded function.

Draws the first lineCount lines in the array lines using the current pen.

void QPainter::drawLines(const QVector\<QLine> \&lines)

This is an overloaded function.

Draws the set of lines defined by the list lines using the current pen and brush.

void QPainter::drawLines(const QPoint *pointPairs, int lineCount)

This is an overloaded function.

Draws the first lineCount lines in the array pointPairs using the current pen.

void QPainter::drawLines(const QVector\<QPoint> \&pointPairs)

This is an overloaded function.

Draws a line for each pair of points in the vector pointPairs using the current pen.

Upstream PySide2 reference signatures (binding differences may apply):

drawLines(self, lines: typing.List[PySide2.QtCore.QLineF]) -> None
drawLines(self, lines: typing.List[PySide2.QtCore.QLine]) -> None
drawLines(self, pointPairs: typing.List[PySide2.QtCore.QPointF]) -> None
drawLines(self, pointPairs: typing.List[PySide2.QtCore.QPoint]) -> None

Source: https://doc.qt.io/archives/qt-5.15/qpainter.html#drawLines

drawPath

drawPath(path: Any) -> None

X.drawPath(path)

Supplemental documentation: Qt 5 reference:

void QPainter::drawPath(const QPainterPath \&path)

Draws the given painter path using the current pen for outline and the current brush for filling.

QPainterPath path; path.moveTo(20, 80); path.lineTo(20, 30); path.cubicTo(80, 0, 50, 50, 80, 80); QPainter painter(this); painter.drawPath(path);

See also the Painter Paths example and the Vector Deformation example.

Upstream PySide2 reference signatures (binding differences may apply):

drawPath(self, path: PySide2.QtGui.QPainterPath) -> None

Source: https://doc.qt.io/archives/qt-5.15/qpainter.html#drawPath

drawPicture

drawPicture(x: Any, y: Any, picture: Any) -> None

X.drawPicture(x, y, picture)

Supplemental documentation: Qt 5 reference:

void QPainter::drawPicture(const QPointF \&point, const QPicture \&picture)

Replays the given picture at the given point.

The QPicture class is a paint device that records and replays QPainter commands. A picture serializes the painter commands to an IO device in a platform-independent format. Everything that can be painted on a widget or pixmap can also be stored in a picture.

This function does exactly the same as QPicture::play() when called with point \= QPoint(0, 0).

QPicture picture; QPointF point(10.0, 20.0) picture.load("drawing.pic"); QPainter painter(this); painter.drawPicture(0, 0, picture);

See also QPicture::play().

void QPainter::drawPicture(int x, int y, const QPicture \&picture)

This is an overloaded function.

Draws the given picture at point (x, y).

void QPainter::drawPicture(const QPoint \&point, const QPicture \&picture)

This is an overloaded function.

Replays the given picture at the given point.

Upstream PySide2 reference signatures (binding differences may apply):

drawPicture(self, p: PySide2.QtCore.QPoint, picture: PySide2.QtGui.QPicture) -> None
drawPicture(self, p: PySide2.QtCore.QPointF, picture: PySide2.QtGui.QPicture) -> None
drawPicture(self, x: int, y: int, picture: PySide2.QtGui.QPicture) -> None

Source: https://doc.qt.io/archives/qt-5.15/qpainter.html#drawPicture

drawPie

drawPie(x: Any, y: Any, w: Any, h: Any, a: int, alen: int) -> None

X.drawPie(x, y, w, h, a, alen)

Supplemental documentation: Qt 5 reference:

void QPainter::drawPie(const QRectF \&rectangle, int startAngle, int spanAngle)

Draws a pie defined by the given rectangle, startAngle and spanAngle.

The pie is filled with the current brush().

The startAngle and spanAngle must be specified in 1/16th of a degree, i.e. a full circle equals 5760 (16 * 360). Positive values for the angles mean counter-clockwise while negative values mean the clockwise direction. Zero degrees is at the 3 o'clock position.

QRectF rectangle(10.0, 20.0, 80.0, 60.0); int startAngle = 30 * 16; int spanAngle = 120 * 16; QPainter painter(this); painter.drawPie(rectangle, startAngle, spanAngle);

See also drawEllipse(), drawChord(), and Coordinate System.

void QPainter::drawPie(int x, int y, int width, int height, int startAngle, int spanAngle)

This is an overloaded function.

Draws the pie defined by the rectangle beginning at (x, y) with the specified width and height, and the given startAngle and spanAngle.

void QPainter::drawPie(const QRect \&rectangle, int startAngle, int spanAngle)

This is an overloaded function.

Draws a pie defined by the given rectangle, startAngle and and spanAngle.

Upstream PySide2 reference signatures (binding differences may apply):

drawPie(self, arg__1: PySide2.QtCore.QRect, a: int, alen: int) -> None
drawPie(self, rect: PySide2.QtCore.QRectF, a: int, alen: int) -> None
drawPie(self, x: int, y: int, w: int, h: int, a: int, alen: int) -> None

Source: https://doc.qt.io/archives/qt-5.15/qpainter.html#drawPie

drawPixmap

drawPixmap(x: Any, y: Any, w: Any, h: Any, pm: Any, sx: Any, sy: Any, sw: Any, sh: Any) -> None

X.drawPixmap(x, y, w, h, pm, sx, sy, sw, sh)

Supplemental documentation: Qt 5 reference:

void QPainter::drawPixmap(const QRectF \&target, const QPixmap \&pixmap, const QRectF \&source)

Draws the rectangular portion source of the given pixmap into the given target in the paint device.

Note: The pixmap is scaled to fit the rectangle, if both the pixmap and rectangle size disagree.

Note: See Drawing High Resolution Versions of Pixmaps and Images on how this is affected by QPixmap::devicePixelRatio().

QRectF target(10.0, 20.0, 80.0, 60.0); QRectF source(0.0, 0.0, 70.0, 40.0); QPixmap pixmap(":myPixmap.png"); QPainter(this); painter.drawPixmap(target, pixmap, source);

If pixmap is a QBitmap it is drawn with the bits that are "set" using the pens color. If backgroundMode is Qt::OpaqueMode, the "unset" bits are drawn using the color of the background brush; if backgroundMode is Qt::TransparentMode, the "unset" bits are transparent. Drawing bitmaps with gradient or texture colors is not supported.

See also drawImage() and QPixmap::devicePixelRatio().

void QPainter::drawPixmap(const QRect \&target, const QPixmap \&pixmap, const QRect \&source)

This is an overloaded function.

Draws the rectangular portion source of the given pixmap into the given target in the paint device.

Note: The pixmap is scaled to fit the rectangle, if both the pixmap and rectangle size disagree.

void QPainter::drawPixmap(int x, int y, int w, int h, const QPixmap \&pixmap, int sx, int sy, int sw, int sh)

This is an overloaded function.

Draws the rectangular portion with the origin (sx, sy), width sw and height sh, of the given pixmap , at the point (x, y), with a width of w and a height of h. If sw or sh are equal to zero the width/height of the pixmap is used and adjusted by the offset sx/sy;

void QPainter::drawPixmap(int x, int y, const QPixmap \&pixmap, int sx, int sy, int sw, int sh)

This is an overloaded function.

Draws a pixmap at (x, y) by copying a part of the given pixmap into the paint device.

(x, y) specifies the top-left point in the paint device that is to be drawn onto. (sx, sy) specifies the top-left point in pixmap that is to be drawn. The default is (0, 0).

(sw, sh) specifies the size of the pixmap that is to be drawn. The default, (0, 0) (and negative) means all the way to the bottom-right of the pixmap.

void QPainter::drawPixmap(const QPointF \&point, const QPixmap \&pixmap, const QRectF \&source)

This is an overloaded function.

Draws the rectangular portion source of the given pixmap with its origin at the given point.

void QPainter::drawPixmap(const QPoint \&point, const QPixmap \&pixmap, const QRect \&source)

This is an overloaded function.

Draws the rectangular portion source of the given pixmap with its origin at the given point.

void QPainter::drawPixmap(const QPointF \&point, const QPixmap \&pixmap)

This is an overloaded function.

Draws the given pixmap with its origin at the given point.

void QPainter::drawPixmap(const QPoint \&point, const QPixmap \&pixmap)

This is an overloaded function.

Draws the given pixmap with its origin at the given point.

void QPainter::drawPixmap(int x, int y, const QPixmap \&pixmap)

This is an overloaded function.

Draws the given pixmap at position (x, y).

void QPainter::drawPixmap(const QRect \&rectangle, const QPixmap \&pixmap)

This is an overloaded function.

Draws the given pixmap into the given rectangle.

Note: The pixmap is scaled to fit the rectangle, if both the pixmap and rectangle size disagree.

void QPainter::drawPixmap(int x, int y, int width, int height, const QPixmap \&pixmap)

This is an overloaded function.

Draws the pixmap into the rectangle at position (x, y) with the given width and height.

Upstream PySide2 reference signatures (binding differences may apply):

drawPixmap(self, p: PySide2.QtCore.QPoint, pm: PySide2.QtGui.QPixmap) -> None
drawPixmap(self, p: PySide2.QtCore.QPoint, pm: PySide2.QtGui.QPixmap, sr: PySide2.QtCore.QRect) -> None
drawPixmap(self, p: PySide2.QtCore.QPointF, pm: PySide2.QtGui.QPixmap) -> None
drawPixmap(self, p: PySide2.QtCore.QPointF, pm: PySide2.QtGui.QPixmap, sr: PySide2.QtCore.QRectF) -> None
drawPixmap(self, r: PySide2.QtCore.QRect, pm: PySide2.QtGui.QPixmap) -> None
drawPixmap(self, targetRect: PySide2.QtCore.QRect, pixmap: PySide2.QtGui.QPixmap, sourceRect: PySide2.QtCore.QRect) -> None
drawPixmap(self, targetRect: PySide2.QtCore.QRectF, pixmap: PySide2.QtGui.QPixmap, sourceRect: PySide2.QtCore.QRectF) -> None
drawPixmap(self, x: int, y: int, pm: PySide2.QtGui.QPixmap) -> None
drawPixmap(self, x: int, y: int, pm: PySide2.QtGui.QPixmap, sx: int, sy: int, sw: int, sh: int) -> None
drawPixmap(self, x: int, y: int, w: int, h: int, pm: PySide2.QtGui.QPixmap) -> None
drawPixmap(self, x: int, y: int, w: int, h: int, pm: PySide2.QtGui.QPixmap, sx: int, sy: int, sw: int, sh: int) -> None

Source: https://doc.qt.io/archives/qt-5.15/qpainter.html#drawPixmap

drawPixmapFragments

drawPixmapFragments(fragments: Any, fragmentCount: int, pixmap: Any, hints: Any) -> None

X.drawPixmapFragments(fragments, fragmentCount, pixmap, hints)

Supplemental documentation: Qt 5 reference:

void QPainter::drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap \&pixmap, QPainter::PixmapFragmentHints hints \= PixmapFragmentHints())

This function is used to draw pixmap, or a sub-rectangle of pixmap, at multiple positions with different scale, rotation and opacity. fragments is an array of fragmentCount elements specifying the parameters used to draw each pixmap fragment. The hints parameter can be used to pass in drawing hints.

This function is potentially faster than multiple calls to drawPixmap(), since the backend can optimize state changes.

This function was introduced in Qt 4.7.

See also QPainter::PixmapFragment and QPainter::PixmapFragmentHint.

Upstream PySide2 reference signatures (binding differences may apply):

drawPixmapFragments(self, fragments: PySide2.QtGui.QPainter.PixmapFragment, fragmentCount: int, pixmap: PySide2.QtGui.QPixmap, hints: PySide2.QtGui.QPainter.PixmapFragmentHints=...) -> None

Source: https://doc.qt.io/archives/qt-5.15/qpainter.html#drawPixmapFragments

drawPoint

drawPoint(x: Any, y: Any) -> None

X.drawPoint(x, y)

Supplemental documentation: Qt 5 reference:

void QPainter::drawPoint(const QPointF \&position)

Draws a single point at the given position using the current pen's color.

See also Coordinate System.

void QPainter::drawPoint(const QPoint \&position)

This is an overloaded function.

Draws a single point at the given position using the current pen's color.

void QPainter::drawPoint(int x, int y)

This is an overloaded function.

Draws a single point at position (x, y).

Upstream PySide2 reference signatures (binding differences may apply):

drawPoint(self, p: PySide2.QtCore.QPoint) -> None
drawPoint(self, pt: PySide2.QtCore.QPointF) -> None
drawPoint(self, x: int, y: int) -> None

Source: https://doc.qt.io/archives/qt-5.15/qpainter.html#drawPoint