![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
The QStylePainter class is a convenience class for drawing QStyle elements inside a widget. More...
#include <qstylepainter.h>
Public Member Functions | |
QStylePainter () | |
Constructs a QStylePainter. | |
QStylePainter (QWidget *w) | |
Construct a QStylePainter using widget widget for its paint device. | |
QStylePainter (QPaintDevice *pd, QWidget *w) | |
Construct a QStylePainter using pd for its paint device, and attributes from widget. | |
bool | begin (QWidget *w) |
Begin painting operations on the specified widget. | |
bool | begin (QPaintDevice *pd, QWidget *w) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Begin painting operations on paint device pd as if it was widget. | |
void | drawPrimitive (QStyle::PrimitiveElement pe, const QStyleOption &opt) |
Use the widget's style to draw a primitive element pe specified by QStyleOption option. | |
void | drawControl (QStyle::ControlElement ce, const QStyleOption &opt) |
Use the widget's style to draw a control element ce specified by QStyleOption option. | |
void | drawComplexControl (QStyle::ComplexControl cc, const QStyleOptionComplex &opt) |
Use the widget's style to draw a complex control cc specified by the QStyleOptionComplex option. | |
void | drawItemText (const QRect &r, int flags, const QPalette &pal, bool enabled, const QString &text, QPalette::ColorRole textRole=QPalette::NoRole) |
Draws the text in rectangle rect and palette pal. | |
void | drawItemPixmap (const QRect &r, int flags, const QPixmap &pixmap) |
Draws the pixmap in rectangle rect. | |
QStyle * | style () const |
Return the current style used by the QStylePainter. | |
![]() | |
QPainter () | |
Constructs a painter. | |
QPainter (QPaintDevice *) | |
Constructs a painter that begins painting the paint device immediately. | |
~QPainter () | |
Destroys the painter. | |
QPaintDevice * | device () const |
Returns the paint device on which this painter is currently painting, or \nullptr if the painter is not active. | |
bool | begin (QPaintDevice *) |
Begins painting the paint device and returns true if successful; otherwise returns false . | |
bool | end () |
Ends painting. | |
bool | isActive () const |
Returns true if begin() has been called and end() has not yet been called; otherwise returns false . | |
void | setCompositionMode (CompositionMode mode) |
Sets the composition mode to the given mode. | |
CompositionMode | compositionMode () const |
Returns the current composition mode. | |
const QFont & | font () const |
Returns the currently set font used for drawing text. | |
void | setFont (const QFont &f) |
Sets the painter's font to the given font. | |
QFontMetrics | fontMetrics () const |
Returns the font metrics for the painter if the painter is active. | |
QFontInfo | fontInfo () const |
Returns the font info for the painter if the painter is active. | |
void | setPen (const QColor &color) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the painter's pen to have style Qt::SolidLine, width 1 and the specified color. | |
void | setPen (const QPen &pen) |
Sets the painter's pen to be the given pen. | |
void | setPen (Qt::PenStyle style) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the painter's pen to have the given style, width 1 and black color. | |
const QPen & | pen () const |
Returns the painter's current pen. | |
void | setBrush (const QBrush &brush) |
Sets the painter's brush to the given brush. | |
void | setBrush (Qt::BrushStyle style) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the painter's brush to black color and the specified style. | |
void | setBrush (QColor color) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
void | setBrush (Qt::GlobalColor color) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
const QBrush & | brush () const |
Returns the painter's current brush. | |
void | setBackgroundMode (Qt::BGMode mode) |
Sets the background mode of the painter to the given mode. | |
Qt::BGMode | backgroundMode () const |
Returns the current background mode. | |
QPoint | brushOrigin () const |
Returns the currently set brush origin. | |
void | setBrushOrigin (int x, int y) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the brush's origin to point (x, y). | |
void | setBrushOrigin (const QPoint &) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the brush's origin to the given position. | |
void | setBrushOrigin (const QPointF &) |
Sets the brush origin to position. | |
void | setBackground (const QBrush &bg) |
Sets the background brush of the painter to the given brush. | |
const QBrush & | background () const |
Returns the current background brush. | |
qreal | opacity () const |
void | setOpacity (qreal opacity) |
QRegion | clipRegion () const |
Returns the currently set clip region. | |
QPainterPath | clipPath () const |
Returns the current clip path in logical coordinates. | |
void | setClipRect (const QRectF &, Qt::ClipOperation op=Qt::ReplaceClip) |
Enables clipping, and sets the clip region to the given rectangle using the given clip operation. | |
void | setClipRect (const QRect &, Qt::ClipOperation op=Qt::ReplaceClip) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Enables clipping, and sets the clip region to the given rectangle using the given clip operation. | |
void | setClipRect (int x, int y, int w, int h, Qt::ClipOperation op=Qt::ReplaceClip) |
Enables clipping, and sets the clip region to the rectangle beginning at (x, y) with the given width and height. | |
void | setClipRegion (const QRegion &, Qt::ClipOperation op=Qt::ReplaceClip) |
Sets the clip region to the given region using the specified clip operation. | |
void | setClipPath (const QPainterPath &path, Qt::ClipOperation op=Qt::ReplaceClip) |
Enables clipping, and sets the clip path for the painter to the given path, with the clip operation. | |
void | setClipping (bool enable) |
Enables clipping if enable is true, or disables clipping if enable is false. | |
bool | hasClipping () const |
Returns true if clipping has been set; otherwise returns false . | |
QRectF | clipBoundingRect () const |
Returns the bounding rectangle of the current clip if there is a clip; otherwise returns an empty rectangle. | |
void | save () |
Saves the current painter state (pushes the state onto a stack). | |
void | restore () |
Restores the current painter state (pops a saved state off the stack). | |
void | setTransform (const QTransform &transform, bool combine=false) |
const QTransform & | transform () const |
Alias for worldTransform(). | |
const QTransform & | deviceTransform () const |
Returns the matrix that transforms from logical coordinates to device coordinates of the platform dependent paint device. | |
void | resetTransform () |
Resets any transformations that were made using translate(), scale(), shear(), rotate(), setWorldTransform(), setViewport() and setWindow(). | |
void | setWorldTransform (const QTransform &matrix, bool combine=false) |
Sets the world transformation matrix. | |
const QTransform & | worldTransform () const |
Returns the world transformation matrix. | |
QTransform | combinedTransform () const |
Returns the transformation matrix combining the current window/viewport and world transformation. | |
void | setWorldMatrixEnabled (bool enabled) |
bool | worldMatrixEnabled () const |
void | scale (qreal sx, qreal sy) |
Scales the coordinate system by ({sx}, {sy}). | |
void | shear (qreal sh, qreal sv) |
Shears the coordinate system by ({sh}, {sv}). | |
void | rotate (qreal a) |
Rotates the coordinate system clockwise. | |
void | translate (const QPointF &offset) |
Translates the coordinate system by the given offset; i.e. | |
void | translate (const QPoint &offset) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Translates the coordinate system by the given offset. | |
void | translate (qreal dx, qreal dy) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Translates the coordinate system by the vector (dx, dy). | |
QRect | window () const |
Returns the window rectangle. | |
void | setWindow (const QRect &window) |
Sets the painter's window to the given rectangle, and enables view transformations. | |
void | setWindow (int x, int y, int w, int h) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the painter's window to the rectangle beginning at (x, y) and the given width and height. | |
QRect | viewport () const |
Returns the viewport rectangle. | |
void | setViewport (const QRect &viewport) |
Sets the painter's viewport rectangle to the given rectangle, and enables view transformations. | |
void | setViewport (int x, int y, int w, int h) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the painter's viewport rectangle to be the rectangle beginning at (x, y) with the given width and height. | |
void | setViewTransformEnabled (bool enable) |
Enables view transformations if enable is true, or disables view transformations if enable is false. | |
bool | viewTransformEnabled () const |
Returns true if view transformation is enabled; otherwise returns false. | |
void | strokePath (const QPainterPath &path, const QPen &pen) |
Draws the outline (strokes) the path path with the pen specified by pen. | |
void | fillPath (const QPainterPath &path, const QBrush &brush) |
Fills the given path using the given brush. | |
void | drawPath (const QPainterPath &path) |
Draws the given painter path using the current pen for outline and the current brush for filling. | |
void | drawPoint (const QPointF &pt) |
Draws a single point at the given position using the current pen's color. | |
void | drawPoint (const QPoint &p) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws a single point at the given position using the current pen's color. | |
void | drawPoint (int x, int y) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws a single point at position (x, y). | |
void | drawPoints (const QPointF *points, int pointCount) |
Draws the first pointCount points in the array points using the current pen's color. | |
void | drawPoints (const QPolygonF &points) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws the points in the vector points. | |
void | drawPoints (const QPoint *points, int pointCount) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws the first pointCount points in the array points using the current pen's color. | |
void | drawPoints (const QPolygon &points) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws the points in the vector points. | |
void | drawLine (const QLineF &line) |
Draws a line defined by line. | |
void | drawLine (const QLine &line) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws a line defined by line. | |
void | drawLine (int x1, int y1, int x2, int y2) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws a line from (x1, y1) to (x2, y2). | |
void | drawLine (const QPoint &p1, const QPoint &p2) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws a line from p1 to p2. | |
void | drawLine (const QPointF &p1, const QPointF &p2) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws a line from p1 to p2. | |
void | drawLines (const QLineF *lines, int lineCount) |
Draws the first lineCount lines in the array lines using the current pen. | |
void | drawLines (const QList< QLineF > &lines) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws the set of lines defined by the list lines using the current pen and brush. | |
void | drawLines (const QPointF *pointPairs, int lineCount) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws the first lineCount lines in the array pointPairs using the current pen. | |
void | drawLines (const QList< QPointF > &pointPairs) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws a line for each pair of points in the vector pointPairs using the current pen. | |
void | drawLines (const QLine *lines, int lineCount) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws the first lineCount lines in the array lines using the current pen. | |
void | drawLines (const QList< QLine > &lines) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws the set of lines defined by the list lines using the current pen and brush. | |
void | drawLines (const QPoint *pointPairs, int lineCount) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws the first lineCount lines in the array pointPairs using the current pen. | |
void | drawLines (const QList< QPoint > &pointPairs) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws a line for each pair of points in the vector pointPairs using the current pen. | |
void | drawRect (const QRectF &rect) |
Draws the current rectangle with the current pen and brush. | |
void | drawRect (int x1, int y1, int w, int h) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws a rectangle with upper left corner at ({x}, {y}) and with the given width and height. | |
void | drawRect (const QRect &rect) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws the current rectangle with the current pen and brush. | |
void | drawRects (const QRectF *rects, int rectCount) |
Draws the first rectCount of the given rectangles using the current pen and brush. | |
void | drawRects (const QList< QRectF > &rectangles) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws the given rectangles using the current pen and brush. | |
void | drawRects (const QRect *rects, int rectCount) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws the first rectCount of the given rectangles using the current pen and brush. | |
void | drawRects (const QList< QRect > &rectangles) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws the given rectangles using the current pen and brush. | |
void | drawEllipse (const QRectF &r) |
Draws the ellipse defined by the given rectangle. | |
void | drawEllipse (const QRect &r) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws the ellipse defined by the given rectangle. | |
void | drawEllipse (int x, int y, int w, int h) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws the ellipse defined by the rectangle beginning at ({x}, {y}) with the given width and height. | |
void | drawEllipse (const QPointF ¢er, qreal rx, qreal ry) |
void | drawEllipse (const QPoint ¢er, int rx, int ry) |
void | drawPolyline (const QPointF *points, int pointCount) |
Draws the polyline defined by the first pointCount points in points using the current pen. | |
void | drawPolyline (const QPolygonF &polyline) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws the polyline defined by the given points using the current pen. | |
void | drawPolyline (const QPoint *points, int pointCount) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws the polyline defined by the first pointCount points in points using the current pen. | |
void | drawPolyline (const QPolygon &polygon) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws the polyline defined by the given points using the current pen. | |
void | drawPolygon (const QPointF *points, int pointCount, Qt::FillRule fillRule=Qt::OddEvenFill) |
Draws the polygon defined by the first pointCount points in the array points using the current pen and brush. | |
void | drawPolygon (const QPolygonF &polygon, Qt::FillRule fillRule=Qt::OddEvenFill) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws the polygon defined by the given points using the fill rule fillRule. | |
void | drawPolygon (const QPoint *points, int pointCount, Qt::FillRule fillRule=Qt::OddEvenFill) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws the polygon defined by the first pointCount points in the array points. | |
void | drawPolygon (const QPolygon &polygon, Qt::FillRule fillRule=Qt::OddEvenFill) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws the polygon defined by the given points using the fill rule fillRule. | |
void | drawConvexPolygon (const QPointF *points, int pointCount) |
Draws the convex polygon defined by the first pointCount points in the array points using the current pen. | |
void | drawConvexPolygon (const QPolygonF &polygon) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws the convex polygon defined by polygon using the current pen and brush. | |
void | drawConvexPolygon (const QPoint *points, int pointCount) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws the convex polygon defined by the first pointCount points in the array points using the current pen. | |
void | drawConvexPolygon (const QPolygon &polygon) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws the convex polygon defined by polygon using the current pen and brush. | |
void | drawArc (const QRectF &rect, int a, int alen) |
Draws the arc defined by the given rectangle, startAngle and spanAngle. | |
void | drawArc (const QRect &, int a, int alen) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws the arc defined by the given rectangle, startAngle and spanAngle. | |
void | drawArc (int x, int y, int w, int h, int a, int alen) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws the arc defined by the rectangle beginning at (x, y) with the specified width and height, and the given startAngle and spanAngle. | |
void | drawPie (const QRectF &rect, int a, int alen) |
Draws a pie defined by the given rectangle, startAngle and spanAngle. | |
void | drawPie (int x, int y, int w, int h, int a, int alen) |
void | drawPie (const QRect &, int a, int alen) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws a pie defined by the given rectangle, startAngle and and spanAngle. | |
void | drawChord (const QRectF &rect, int a, int alen) |
Draws the chord defined by the given rectangle, startAngle and spanAngle. | |
void | drawChord (int x, int y, int w, int h, int a, int alen) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws the chord defined by the rectangle beginning at (x, y) with the specified width and height, and the given startAngle and spanAngle. | |
void | drawChord (const QRect &, int a, int alen) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws the chord defined by the given rectangle, startAngle and spanAngle. | |
void | drawRoundedRect (const QRectF &rect, qreal xRadius, qreal yRadius, Qt::SizeMode mode=Qt::AbsoluteSize) |
void | drawRoundedRect (int x, int y, int w, int h, qreal xRadius, qreal yRadius, Qt::SizeMode mode=Qt::AbsoluteSize) |
void | drawRoundedRect (const QRect &rect, qreal xRadius, qreal yRadius, Qt::SizeMode mode=Qt::AbsoluteSize) |
void | drawTiledPixmap (const QRectF &rect, const QPixmap &pm, const QPointF &offset=QPointF()) |
Draws a tiled pixmap, inside the given rectangle with its origin at the given position. | |
void | drawTiledPixmap (int x, int y, int w, int h, const QPixmap &, int sx=0, int sy=0) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws a tiled pixmap in the specified rectangle. | |
void | drawTiledPixmap (const QRect &, const QPixmap &, const QPoint &=QPoint()) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws a tiled pixmap, inside the given rectangle with its origin at the given position. | |
void | drawPicture (const QPointF &p, const QPicture &picture) |
Replays the given picture at the given point. | |
void | drawPicture (int x, int y, const QPicture &picture) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws the given picture at point (x, y). | |
void | drawPicture (const QPoint &p, const QPicture &picture) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Replays the given picture at the given point. | |
void | drawPixmap (const QRectF &targetRect, const QPixmap &pixmap, const QRectF &sourceRect) |
Draws the rectangular portion source of the given pixmap into the given target in the paint device. | |
void | drawPixmap (const QRect &targetRect, const QPixmap &pixmap, const QRect &sourceRect) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws the rectangular portion source of the given pixmap into the given target in the paint device. | |
void | drawPixmap (int x, int y, int w, int h, const QPixmap &pm, int sx, int sy, int sw, int sh) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.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. | |
void | drawPixmap (int x, int y, const QPixmap &pm, int sx, int sy, int sw, int sh) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws a pixmap at ({x}, {y}) by copying a part of the given pixmap into the paint device. | |
void | drawPixmap (const QPointF &p, const QPixmap &pm, const QRectF &sr) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws the rectangular portion source of the given pixmap with its origin at the given point. | |
void | drawPixmap (const QPoint &p, const QPixmap &pm, const QRect &sr) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws the rectangular portion source of the given pixmap with its origin at the given point. | |
void | drawPixmap (const QPointF &p, const QPixmap &pm) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws the given pixmap with its origin at the given point. | |
void | drawPixmap (const QPoint &p, const QPixmap &pm) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws the given pixmap with its origin at the given point. | |
void | drawPixmap (int x, int y, const QPixmap &pm) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws the given pixmap at position ({x}, {y}). | |
void | drawPixmap (const QRect &r, const QPixmap &pm) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws the given pixmap into the given rectangle. | |
void | drawPixmap (int x, int y, int w, int h, const QPixmap &pm) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws the pixmap into the rectangle at position ({x}, {y}) with the given width and height. | |
void | drawPixmapFragments (const PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap, PixmapFragmentHints hints=PixmapFragmentHints()) |
void | drawImage (const QRectF &targetRect, const QImage &image, const QRectF &sourceRect, Qt::ImageConversionFlags flags=Qt::AutoColor) |
Draws the rectangular portion source of the given image into the target rectangle in the paint device. | |
void | drawImage (const QRect &targetRect, const QImage &image, const QRect &sourceRect, Qt::ImageConversionFlags flags=Qt::AutoColor) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws the rectangular portion source of the given image into the target rectangle in the paint device. | |
void | drawImage (const QPointF &p, const QImage &image, const QRectF &sr, Qt::ImageConversionFlags flags=Qt::AutoColor) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws the rectangular portion source of the given image with its origin at the given point. | |
void | drawImage (const QPoint &p, const QImage &image, const QRect &sr, Qt::ImageConversionFlags flags=Qt::AutoColor) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws the rectangular portion source of the given image with its origin at the given point. | |
void | drawImage (const QRectF &r, const QImage &image) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws the given image into the given rectangle. | |
void | drawImage (const QRect &r, const QImage &image) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws the given image into the given rectangle. | |
void | drawImage (const QPointF &p, const QImage &image) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws the given image at the given point. | |
void | drawImage (const QPoint &p, const QImage &image) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws the given image at the given point. | |
void | 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 member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws an image at ({x}, {y}) by copying a part of image into the paint device. | |
void | setLayoutDirection (Qt::LayoutDirection direction) |
Sets the layout direction used by the painter when drawing text, to the specified direction. | |
Qt::LayoutDirection | layoutDirection () const |
Returns the layout direction used by the painter when drawing text. | |
void | drawGlyphRun (const QPointF &position, const QGlyphRun &glyphRun) |
Draws the glyphs represented by glyphs at position. | |
void | drawStaticText (const QPointF &topLeftPosition, const QStaticText &staticText) |
void | drawStaticText (const QPoint &topLeftPosition, const QStaticText &staticText) |
void | drawStaticText (int left, int top, const QStaticText &staticText) |
void | drawText (const QPointF &p, const QString &s) |
Draws the given text with the currently defined text direction, beginning at the given position. | |
void | drawText (const QPoint &p, const QString &s) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws the given text with the currently defined text direction, beginning at the given position. | |
void | drawText (int x, int y, const QString &s) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws the given text at position ({x}, {y}), using the painter's currently defined text direction. | |
void | drawText (const QPointF &p, const QString &str, int tf, int justificationPadding) |
void | drawText (const QRectF &r, int flags, const QString &text, QRectF *br=nullptr) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws the given text within the provided rectangle. | |
void | drawText (const QRect &r, int flags, const QString &text, QRect *br=nullptr) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws the given text within the provided rectangle according to the specified flags. | |
void | drawText (int x, int y, int w, int h, int flags, const QString &text, QRect *br=nullptr) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws the given text within the rectangle with origin ({x}, {y}), width and height. | |
void | drawText (const QRectF &r, const QString &text, const QTextOption &o=QTextOption()) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws the given text in the rectangle specified using the option to control its positioning, direction, and orientation. | |
QRectF | boundingRect (const QRectF &rect, 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. | |
QRect | boundingRect (const QRect &rect, int flags, const QString &text) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.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 | boundingRect (int x, int y, int w, int h, int flags, const QString &text) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.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 | boundingRect (const QRectF &rect, const QString &text, const QTextOption &o=QTextOption()) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Instead of specifying flags as a bitwise OR of the Qt::AlignmentFlag and Qt::TextFlag, this overloaded function takes an option argument. | |
void | drawTextItem (const QPointF &p, const QTextItem &ti) |
void | drawTextItem (int x, int y, const QTextItem &ti) |
void | drawTextItem (const QPoint &p, const QTextItem &ti) |
void | fillRect (const QRectF &, const QBrush &) |
Fills the given rectangle with the brush specified. | |
void | fillRect (int x, int y, int w, int h, const QBrush &) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Fills the rectangle beginning at ({x}, {y}) with the given width and height, using the given brush. | |
void | fillRect (const QRect &, const QBrush &) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Fills the given rectangle with the specified brush. | |
void | fillRect (const QRectF &, const QColor &color) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Fills the given rectangle with the color specified. | |
void | fillRect (int x, int y, int w, int h, const QColor &color) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Fills the rectangle beginning at ({x}, {y}) with the given width and height, using the given color. | |
void | fillRect (const QRect &, const QColor &color) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Fills the given rectangle with the color specified. | |
void | fillRect (int x, int y, int w, int h, Qt::GlobalColor c) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Fills the rectangle beginning at ({x}, {y}) with the given width and height, using the given color. | |
void | fillRect (const QRect &r, Qt::GlobalColor c) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Fills the given rectangle with the specified color. | |
void | fillRect (const QRectF &r, Qt::GlobalColor c) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Fills the given rectangle with the specified color. | |
void | fillRect (int x, int y, int w, int h, Qt::BrushStyle style) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Fills the rectangle beginning at ({x}, {y}) with the given width and height, using the brush style specified. | |
void | fillRect (const QRect &r, Qt::BrushStyle style) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Fills the given rectangle with the brush style specified. | |
void | fillRect (const QRectF &r, Qt::BrushStyle style) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Fills the given rectangle with the brush style specified. | |
void | fillRect (int x, int y, int w, int h, QGradient::Preset preset) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Fills the rectangle beginning at ({x}, {y}) with the given width and height, using the given gradient preset. | |
void | fillRect (const QRect &r, QGradient::Preset preset) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Fills the given rectangle with the specified gradient preset. | |
void | fillRect (const QRectF &r, QGradient::Preset preset) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Fills the given rectangle with the specified gradient preset. | |
void | eraseRect (const QRectF &) |
Erases the area inside the given rectangle. | |
void | eraseRect (int x, int y, int w, int h) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Erases the area inside the rectangle beginning at (x, y) with the given width and height. | |
void | eraseRect (const QRect &) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Erases the area inside the given rectangle. | |
void | setRenderHint (RenderHint hint, bool on=true) |
Sets the given render hint on the painter if on is true; otherwise clears the render hint. | |
void | setRenderHints (RenderHints hints, bool on=true) |
RenderHints | renderHints () const |
Returns a flag that specifies the rendering hints that are set for this painter. | |
bool | testRenderHint (RenderHint hint) const |
QPaintEngine * | paintEngine () const |
Returns the paint engine that the painter is currently operating on if the painter is active; otherwise 0. | |
void | beginNativePainting () |
void | endNativePainting () |
The QStylePainter class is a convenience class for drawing QStyle elements inside a widget.
\inmodule QtWidgets
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:
Example using QStylePainter:
Definition at line 15 of file qstylepainter.h.
|
inline |
Constructs a QStylePainter.
Definition at line 18 of file qstylepainter.h.
|
inlineexplicit |
Construct a QStylePainter using widget widget for its paint device.
Definition at line 19 of file qstylepainter.h.
|
inline |
Construct a QStylePainter using pd for its paint device, and attributes from widget.
Definition at line 20 of file qstylepainter.h.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Begin painting operations on paint device pd as if it was widget.
This is automatically called by the constructor that takes a QPaintDevice and a QWidget.
Definition at line 22 of file qstylepainter.h.
|
inline |
Begin painting operations on the specified widget.
Returns true
if the painter is ready to use; otherwise returns false
.
This is automatically called by the constructor that takes a QWidget.
Definition at line 21 of file qstylepainter.h.
|
inline |
Use the widget's style to draw a complex control cc specified by the QStyleOptionComplex option.
Definition at line 54 of file qstylepainter.h.
|
inline |
Use the widget's style to draw a control element ce specified by QStyleOption option.
Definition at line 49 of file qstylepainter.h.
Draws the pixmap in rectangle rect.
The pixmap is aligned according to flags.
Definition at line 65 of file qstylepainter.h.
|
inline |
Draws the text in rectangle rect and palette pal.
The text is aligned and wrapped according to flags.
The pen color is specified with textRole. The enabled bool indicates whether or not the item is enabled; when reimplementing this bool should influence how the item is drawn.
Definition at line 59 of file qstylepainter.h.
|
inline |
Use the widget's style to draw a primitive element pe specified by QStyleOption option.
Definition at line 44 of file qstylepainter.h.
|
inline |
Return the current style used by the QStylePainter.
Definition at line 36 of file qstylepainter.h.