File indexing completed on 2026-08-03 09:25:42
0001
0002
0003
0004 #ifndef QPAINTER_H
0005 #define QPAINTER_H
0006
0007 #include <QtGui/qtguiglobal.h>
0008 #include <QtCore/qnamespace.h>
0009 #include <QtCore/qrect.h>
0010 #include <QtCore/qpoint.h>
0011 #include <QtCore/qscopedpointer.h>
0012 #include <QtGui/qpixmap.h>
0013 #include <QtGui/qimage.h>
0014 #include <QtGui/qtextoption.h>
0015 #include <memory>
0016
0017 #ifndef QT_INCLUDE_COMPAT
0018 #include <QtGui/qpolygon.h>
0019 #include <QtGui/qpen.h>
0020 #include <QtGui/qbrush.h>
0021 #include <QtGui/qtransform.h>
0022 #include <QtGui/qfontinfo.h>
0023 #include <QtGui/qfontmetrics.h>
0024 #endif
0025
0026 QT_BEGIN_NAMESPACE
0027
0028
0029 class QBrush;
0030 class QFontInfo;
0031 class QFontMetrics;
0032 class QPaintDevice;
0033 class QPainterPath;
0034 class QPainterPrivate;
0035 class QPen;
0036 class QPolygon;
0037 class QTextItem;
0038 class QTextEngine;
0039 class QTransform;
0040 class QStaticText;
0041 class QGlyphRun;
0042
0043 class QPainterPrivateDeleter;
0044
0045 class Q_GUI_EXPORT QPainter
0046 {
0047 Q_DECLARE_PRIVATE(QPainter)
0048 Q_GADGET
0049
0050 public:
0051 enum RenderHint {
0052 Antialiasing = 0x01,
0053 TextAntialiasing = 0x02,
0054 SmoothPixmapTransform = 0x04,
0055 VerticalSubpixelPositioning = 0x08,
0056 LosslessImageRendering = 0x40,
0057 NonCosmeticBrushPatterns = 0x80
0058 };
0059 Q_ENUM(RenderHint)
0060
0061 Q_DECLARE_FLAGS(RenderHints, RenderHint)
0062 Q_FLAG(RenderHints)
0063
0064 class PixmapFragment {
0065 public:
0066 qreal x;
0067 qreal y;
0068 qreal sourceLeft;
0069 qreal sourceTop;
0070 qreal width;
0071 qreal height;
0072 qreal scaleX;
0073 qreal scaleY;
0074 qreal rotation;
0075 qreal opacity;
0076 static PixmapFragment Q_GUI_EXPORT create(const QPointF &pos, const QRectF &sourceRect,
0077 qreal scaleX = 1, qreal scaleY = 1,
0078 qreal rotation = 0, qreal opacity = 1);
0079 };
0080
0081 enum PixmapFragmentHint {
0082 OpaqueHint = 0x01
0083 };
0084
0085 Q_DECLARE_FLAGS(PixmapFragmentHints, PixmapFragmentHint)
0086
0087 QPainter();
0088 explicit QPainter(QPaintDevice *);
0089 ~QPainter();
0090
0091 QPaintDevice *device() const;
0092
0093 bool begin(QPaintDevice *);
0094 bool end();
0095 bool isActive() const;
0096
0097 enum CompositionMode {
0098 CompositionMode_SourceOver,
0099 CompositionMode_DestinationOver,
0100 CompositionMode_Clear,
0101 CompositionMode_Source,
0102 CompositionMode_Destination,
0103 CompositionMode_SourceIn,
0104 CompositionMode_DestinationIn,
0105 CompositionMode_SourceOut,
0106 CompositionMode_DestinationOut,
0107 CompositionMode_SourceAtop,
0108 CompositionMode_DestinationAtop,
0109 CompositionMode_Xor,
0110
0111
0112 CompositionMode_Plus,
0113 CompositionMode_Multiply,
0114 CompositionMode_Screen,
0115 CompositionMode_Overlay,
0116 CompositionMode_Darken,
0117 CompositionMode_Lighten,
0118 CompositionMode_ColorDodge,
0119 CompositionMode_ColorBurn,
0120 CompositionMode_HardLight,
0121 CompositionMode_SoftLight,
0122 CompositionMode_Difference,
0123 CompositionMode_Exclusion,
0124
0125
0126 RasterOp_SourceOrDestination,
0127 RasterOp_SourceAndDestination,
0128 RasterOp_SourceXorDestination,
0129 RasterOp_NotSourceAndNotDestination,
0130 RasterOp_NotSourceOrNotDestination,
0131 RasterOp_NotSourceXorDestination,
0132 RasterOp_NotSource,
0133 RasterOp_NotSourceAndDestination,
0134 RasterOp_SourceAndNotDestination,
0135 RasterOp_NotSourceOrDestination,
0136 RasterOp_SourceOrNotDestination,
0137 RasterOp_ClearDestination,
0138 RasterOp_SetDestination,
0139 RasterOp_NotDestination,
0140
0141 NCompositionModes
0142 };
0143 void setCompositionMode(CompositionMode mode);
0144 CompositionMode compositionMode() const;
0145
0146 const QFont &font() const;
0147 void setFont(const QFont &f);
0148
0149 QFontMetrics fontMetrics() const;
0150 QFontInfo fontInfo() const;
0151
0152 void setPen(const QColor &color);
0153 QT_GUI_INLINE_SINCE(6, 11)
0154 void setPen(const QPen &pen);
0155 void setPen(QPen &&pen) { doSetPen(pen, &pen); }
0156 void setPen(Qt::PenStyle style);
0157 const QPen &pen() const;
0158
0159 QT_GUI_INLINE_SINCE(6, 11)
0160 void setBrush(const QBrush &brush);
0161 void setBrush(QBrush &&brush) { doSetBrush(brush, &brush); }
0162 void setBrush(Qt::BrushStyle style);
0163 void setBrush(QColor color);
0164 void setBrush(Qt::GlobalColor color) { setBrush(QColor(color)); }
0165 const QBrush &brush() const;
0166
0167
0168 void setBackgroundMode(Qt::BGMode mode);
0169 Qt::BGMode backgroundMode() const;
0170
0171 QPoint brushOrigin() const;
0172 QPointF brushOriginF() const;
0173 inline void setBrushOrigin(int x, int y);
0174 inline void setBrushOrigin(const QPoint &);
0175 void setBrushOrigin(const QPointF &);
0176
0177 void setBackground(const QBrush &bg);
0178 const QBrush &background() const;
0179
0180 qreal opacity() const;
0181 void setOpacity(qreal opacity);
0182
0183
0184 QRegion clipRegion() const;
0185 QPainterPath clipPath() const;
0186
0187 void setClipRect(const QRectF &, Qt::ClipOperation op = Qt::ReplaceClip);
0188 void setClipRect(const QRect &, Qt::ClipOperation op = Qt::ReplaceClip);
0189 inline void setClipRect(int x, int y, int w, int h, Qt::ClipOperation op = Qt::ReplaceClip);
0190
0191 void setClipRegion(const QRegion &, Qt::ClipOperation op = Qt::ReplaceClip);
0192
0193 void setClipPath(const QPainterPath &path, Qt::ClipOperation op = Qt::ReplaceClip);
0194
0195 void setClipping(bool enable);
0196 bool hasClipping() const;
0197
0198 QRectF clipBoundingRect() const;
0199
0200 void save();
0201 void restore();
0202
0203
0204 void setTransform(const QTransform &transform, bool combine = false);
0205 const QTransform &transform() const;
0206 const QTransform &deviceTransform() const;
0207 void resetTransform();
0208
0209 void setWorldTransform(const QTransform &matrix, bool combine = false);
0210 const QTransform &worldTransform() const;
0211
0212 QTransform combinedTransform() const;
0213
0214 void setWorldMatrixEnabled(bool enabled);
0215 bool worldMatrixEnabled() const;
0216
0217 void scale(qreal sx, qreal sy);
0218 void shear(qreal sh, qreal sv);
0219 void rotate(qreal a);
0220
0221 void translate(const QPointF &offset);
0222 inline void translate(const QPoint &offset);
0223 inline void translate(qreal dx, qreal dy);
0224
0225 QRect window() const;
0226 void setWindow(const QRect &window);
0227 inline void setWindow(int x, int y, int w, int h);
0228
0229 QRect viewport() const;
0230 void setViewport(const QRect &viewport);
0231 inline void setViewport(int x, int y, int w, int h);
0232
0233 void setViewTransformEnabled(bool enable);
0234 bool viewTransformEnabled() const;
0235
0236
0237 void strokePath(const QPainterPath &path, const QPen &pen);
0238 void fillPath(const QPainterPath &path, const QBrush &brush);
0239 void drawPath(const QPainterPath &path);
0240
0241 inline void drawPoint(const QPointF &pt);
0242 inline void drawPoint(const QPoint &p);
0243 inline void drawPoint(int x, int y);
0244
0245 void drawPoints(const QPointF *points, int pointCount);
0246 inline void drawPoints(const QPolygonF &points);
0247 void drawPoints(const QPoint *points, int pointCount);
0248 inline void drawPoints(const QPolygon &points);
0249
0250 inline void drawLine(const QLineF &line);
0251 inline void drawLine(const QLine &line);
0252 inline void drawLine(int x1, int y1, int x2, int y2);
0253 inline void drawLine(const QPoint &p1, const QPoint &p2);
0254 inline void drawLine(const QPointF &p1, const QPointF &p2);
0255
0256 void drawLines(const QLineF *lines, int lineCount);
0257 inline void drawLines(const QList<QLineF> &lines);
0258 void drawLines(const QPointF *pointPairs, int lineCount);
0259 inline void drawLines(const QList<QPointF> &pointPairs);
0260 void drawLines(const QLine *lines, int lineCount);
0261 inline void drawLines(const QList<QLine> &lines);
0262 void drawLines(const QPoint *pointPairs, int lineCount);
0263 inline void drawLines(const QList<QPoint> &pointPairs);
0264
0265 inline void drawRect(const QRectF &rect);
0266 inline void drawRect(int x1, int y1, int w, int h);
0267 inline void drawRect(const QRect &rect);
0268
0269 void drawRects(const QRectF *rects, int rectCount);
0270 inline void drawRects(const QList<QRectF> &rectangles);
0271 void drawRects(const QRect *rects, int rectCount);
0272 inline void drawRects(const QList<QRect> &rectangles);
0273
0274 void drawEllipse(const QRectF &r);
0275 void drawEllipse(const QRect &r);
0276 inline void drawEllipse(int x, int y, int w, int h);
0277
0278 inline void drawEllipse(const QPointF ¢er, qreal rx, qreal ry);
0279 inline void drawEllipse(const QPoint ¢er, int rx, int ry);
0280
0281 void drawPolyline(const QPointF *points, int pointCount);
0282 inline void drawPolyline(const QPolygonF &polyline);
0283 void drawPolyline(const QPoint *points, int pointCount);
0284 inline void drawPolyline(const QPolygon &polygon);
0285
0286 void drawPolygon(const QPointF *points, int pointCount, Qt::FillRule fillRule = Qt::OddEvenFill);
0287 inline void drawPolygon(const QPolygonF &polygon, Qt::FillRule fillRule = Qt::OddEvenFill);
0288 void drawPolygon(const QPoint *points, int pointCount, Qt::FillRule fillRule = Qt::OddEvenFill);
0289 inline void drawPolygon(const QPolygon &polygon, Qt::FillRule fillRule = Qt::OddEvenFill);
0290
0291 void drawConvexPolygon(const QPointF *points, int pointCount);
0292 inline void drawConvexPolygon(const QPolygonF &polygon);
0293 void drawConvexPolygon(const QPoint *points, int pointCount);
0294 inline void drawConvexPolygon(const QPolygon &polygon);
0295
0296 void drawArc(const QRectF &rect, int a, int alen);
0297 inline void drawArc(const QRect &, int a, int alen);
0298 inline void drawArc(int x, int y, int w, int h, int a, int alen);
0299
0300 void drawPie(const QRectF &rect, int a, int alen);
0301 inline void drawPie(int x, int y, int w, int h, int a, int alen);
0302 inline void drawPie(const QRect &, int a, int alen);
0303
0304 void drawChord(const QRectF &rect, int a, int alen);
0305 inline void drawChord(int x, int y, int w, int h, int a, int alen);
0306 inline void drawChord(const QRect &, int a, int alen);
0307
0308 void drawRoundedRect(const QRectF &rect, qreal xRadius, qreal yRadius,
0309 Qt::SizeMode mode = Qt::AbsoluteSize);
0310 inline void drawRoundedRect(int x, int y, int w, int h, qreal xRadius, qreal yRadius,
0311 Qt::SizeMode mode = Qt::AbsoluteSize);
0312 inline void drawRoundedRect(const QRect &rect, qreal xRadius, qreal yRadius,
0313 Qt::SizeMode mode = Qt::AbsoluteSize);
0314
0315 void drawTiledPixmap(const QRectF &rect, const QPixmap &pm, const QPointF &offset = QPointF());
0316 inline void drawTiledPixmap(int x, int y, int w, int h, const QPixmap &, int sx=0, int sy=0);
0317 inline void drawTiledPixmap(const QRect &, const QPixmap &, const QPoint & = QPoint());
0318 #ifndef QT_NO_PICTURE
0319 void drawPicture(const QPointF &p, const QPicture &picture);
0320 inline void drawPicture(int x, int y, const QPicture &picture);
0321 inline void drawPicture(const QPoint &p, const QPicture &picture);
0322 #endif
0323
0324 void drawPixmap(const QRectF &targetRect, const QPixmap &pixmap, const QRectF &sourceRect);
0325 inline void drawPixmap(const QRect &targetRect, const QPixmap &pixmap, const QRect &sourceRect);
0326 inline void drawPixmap(int x, int y, int w, int h, const QPixmap &pm,
0327 int sx, int sy, int sw, int sh);
0328 inline void drawPixmap(int x, int y, const QPixmap &pm,
0329 int sx, int sy, int sw, int sh);
0330 inline void drawPixmap(const QPointF &p, const QPixmap &pm, const QRectF &sr);
0331 inline void drawPixmap(const QPoint &p, const QPixmap &pm, const QRect &sr);
0332 void drawPixmap(const QPointF &p, const QPixmap &pm);
0333 inline void drawPixmap(const QPoint &p, const QPixmap &pm);
0334 inline void drawPixmap(int x, int y, const QPixmap &pm);
0335 inline void drawPixmap(const QRect &r, const QPixmap &pm);
0336 inline void drawPixmap(int x, int y, int w, int h, const QPixmap &pm);
0337
0338 void drawPixmapFragments(const PixmapFragment *fragments, int fragmentCount,
0339 const QPixmap &pixmap, PixmapFragmentHints hints = PixmapFragmentHints());
0340
0341 void drawImage(const QRectF &targetRect, const QImage &image, const QRectF &sourceRect,
0342 Qt::ImageConversionFlags flags = Qt::AutoColor);
0343 inline void drawImage(const QRect &targetRect, const QImage &image, const QRect &sourceRect,
0344 Qt::ImageConversionFlags flags = Qt::AutoColor);
0345 inline void drawImage(const QPointF &p, const QImage &image, const QRectF &sr,
0346 Qt::ImageConversionFlags flags = Qt::AutoColor);
0347 inline void drawImage(const QPoint &p, const QImage &image, const QRect &sr,
0348 Qt::ImageConversionFlags flags = Qt::AutoColor);
0349 inline void drawImage(const QRectF &r, const QImage &image);
0350 inline void drawImage(const QRect &r, const QImage &image);
0351 void drawImage(const QPointF &p, const QImage &image);
0352 inline void drawImage(const QPoint &p, const QImage &image);
0353 inline void drawImage(int x, int y, const QImage &image, int sx = 0, int sy = 0,
0354 int sw = -1, int sh = -1, Qt::ImageConversionFlags flags = Qt::AutoColor);
0355
0356 void setLayoutDirection(Qt::LayoutDirection direction);
0357 Qt::LayoutDirection layoutDirection() const;
0358
0359 #if !defined(QT_NO_RAWFONT)
0360 void drawGlyphRun(const QPointF &position, const QGlyphRun &glyphRun);
0361 #endif
0362
0363 void drawStaticText(const QPointF &topLeftPosition, const QStaticText &staticText);
0364 inline void drawStaticText(const QPoint &topLeftPosition, const QStaticText &staticText);
0365 inline void drawStaticText(int left, int top, const QStaticText &staticText);
0366
0367 void drawText(const QPointF &p, const QString &s);
0368 inline void drawText(const QPoint &p, const QString &s);
0369 inline void drawText(int x, int y, const QString &s);
0370
0371 void drawText(const QPointF &p, const QString &str, int tf, int justificationPadding);
0372
0373 void drawText(const QRectF &r, int flags, const QString &text, QRectF *br = nullptr);
0374 void drawText(const QRect &r, int flags, const QString &text, QRect *br = nullptr);
0375 inline void drawText(int x, int y, int w, int h, int flags, const QString &text, QRect *br = nullptr);
0376
0377 void drawText(const QRectF &r, const QString &text, const QTextOption &o = QTextOption());
0378
0379 QRectF boundingRect(const QRectF &rect, int flags, const QString &text);
0380 QRect boundingRect(const QRect &rect, int flags, const QString &text);
0381 inline QRect boundingRect(int x, int y, int w, int h, int flags, const QString &text);
0382
0383 QRectF boundingRect(const QRectF &rect, const QString &text, const QTextOption &o = QTextOption());
0384
0385 void drawTextItem(const QPointF &p, const QTextItem &ti);
0386 inline void drawTextItem(int x, int y, const QTextItem &ti);
0387 inline void drawTextItem(const QPoint &p, const QTextItem &ti);
0388
0389 void fillRect(const QRectF &, const QBrush &);
0390 inline void fillRect(int x, int y, int w, int h, const QBrush &);
0391 void fillRect(const QRect &, const QBrush &);
0392
0393 void fillRect(const QRectF &, const QColor &color);
0394 inline void fillRect(int x, int y, int w, int h, const QColor &color);
0395 void fillRect(const QRect &, const QColor &color);
0396
0397 inline void fillRect(int x, int y, int w, int h, Qt::GlobalColor c);
0398 inline void fillRect(const QRect &r, Qt::GlobalColor c);
0399 inline void fillRect(const QRectF &r, Qt::GlobalColor c);
0400
0401 inline void fillRect(int x, int y, int w, int h, Qt::BrushStyle style);
0402 inline void fillRect(const QRect &r, Qt::BrushStyle style);
0403 inline void fillRect(const QRectF &r, Qt::BrushStyle style);
0404
0405 inline void fillRect(int x, int y, int w, int h, QGradient::Preset preset);
0406 inline void fillRect(const QRect &r, QGradient::Preset preset);
0407 inline void fillRect(const QRectF &r, QGradient::Preset preset);
0408
0409 void eraseRect(const QRectF &);
0410 inline void eraseRect(int x, int y, int w, int h);
0411 inline void eraseRect(const QRect &);
0412
0413 void setRenderHint(RenderHint hint, bool on = true);
0414 void setRenderHints(RenderHints hints, bool on = true);
0415 RenderHints renderHints() const;
0416 inline bool testRenderHint(RenderHint hint) const { return bool(renderHints() & hint); }
0417
0418 QPaintEngine *paintEngine() const;
0419
0420 void beginNativePainting();
0421 void endNativePainting();
0422
0423 private:
0424 Q_DISABLE_COPY(QPainter)
0425
0426 void doSetPen(const QPen &lvalue, QPen *rvalue);
0427 void doSetBrush(const QBrush &lvalue, QBrush *rvalue);
0428
0429 std::unique_ptr<QPainterPrivate> d_ptr;
0430
0431 friend class QWidget;
0432 friend class QFontEngine;
0433 friend class QFontEngineBox;
0434 friend class QFontEngineFT;
0435 friend class QFontEngineMac;
0436 friend class QFontEngineWin;
0437 friend class QPaintEngine;
0438 friend class QPaintEngineExPrivate;
0439 friend class QOpenGLPaintEngine;
0440 friend class QWin32PaintEngine;
0441 friend class QWin32PaintEnginePrivate;
0442 friend class QRasterPaintEngine;
0443 friend class QAlphaPaintEngine;
0444 friend class QPreviewPaintEngine;
0445 friend class QTextEngine;
0446 };
0447 Q_DECLARE_TYPEINFO(QPainter::PixmapFragment, Q_RELOCATABLE_TYPE);
0448
0449 Q_DECLARE_OPERATORS_FOR_FLAGS(QPainter::RenderHints)
0450
0451
0452
0453
0454 inline void QPainter::drawLine(const QLineF &l)
0455 {
0456 drawLines(&l, 1);
0457 }
0458
0459 inline void QPainter::drawLine(const QLine &line)
0460 {
0461 drawLines(&line, 1);
0462 }
0463
0464 inline void QPainter::drawLine(int x1, int y1, int x2, int y2)
0465 {
0466 QLine l(x1, y1, x2, y2);
0467 drawLines(&l, 1);
0468 }
0469
0470 inline void QPainter::drawLine(const QPoint &p1, const QPoint &p2)
0471 {
0472 QLine l(p1, p2);
0473 drawLines(&l, 1);
0474 }
0475
0476 inline void QPainter::drawLine(const QPointF &p1, const QPointF &p2)
0477 {
0478 drawLine(QLineF(p1, p2));
0479 }
0480
0481 inline void QPainter::drawLines(const QList<QLineF> &lines)
0482 {
0483 drawLines(lines.constData(), int(lines.size()));
0484 }
0485
0486 inline void QPainter::drawLines(const QList<QLine> &lines)
0487 {
0488 drawLines(lines.constData(), int(lines.size()));
0489 }
0490
0491 inline void QPainter::drawLines(const QList<QPointF> &pointPairs)
0492 {
0493 drawLines(pointPairs.constData(), int(pointPairs.size() / 2));
0494 }
0495
0496 inline void QPainter::drawLines(const QList<QPoint> &pointPairs)
0497 {
0498 drawLines(pointPairs.constData(), int(pointPairs.size() / 2));
0499 }
0500
0501 inline void QPainter::drawPolyline(const QPolygonF &polyline)
0502 {
0503 drawPolyline(polyline.constData(), int(polyline.size()));
0504 }
0505
0506 inline void QPainter::drawPolyline(const QPolygon &polyline)
0507 {
0508 drawPolyline(polyline.constData(), int(polyline.size()));
0509 }
0510
0511 inline void QPainter::drawPolygon(const QPolygonF &polygon, Qt::FillRule fillRule)
0512 {
0513 drawPolygon(polygon.constData(), int(polygon.size()), fillRule);
0514 }
0515
0516 inline void QPainter::drawPolygon(const QPolygon &polygon, Qt::FillRule fillRule)
0517 {
0518 drawPolygon(polygon.constData(), int(polygon.size()), fillRule);
0519 }
0520
0521 inline void QPainter::drawConvexPolygon(const QPolygonF &poly)
0522 {
0523 drawConvexPolygon(poly.constData(), int(poly.size()));
0524 }
0525
0526 inline void QPainter::drawConvexPolygon(const QPolygon &poly)
0527 {
0528 drawConvexPolygon(poly.constData(), int(poly.size()));
0529 }
0530
0531 inline void QPainter::drawRect(const QRectF &rect)
0532 {
0533 drawRects(&rect, 1);
0534 }
0535
0536 inline void QPainter::drawRect(int x, int y, int w, int h)
0537 {
0538 QRect r(x, y, w, h);
0539 drawRects(&r, 1);
0540 }
0541
0542 inline void QPainter::drawRect(const QRect &r)
0543 {
0544 drawRects(&r, 1);
0545 }
0546
0547 inline void QPainter::drawRects(const QList<QRectF> &rects)
0548 {
0549 drawRects(rects.constData(), int(rects.size()));
0550 }
0551
0552 inline void QPainter::drawRects(const QList<QRect> &rects)
0553 {
0554 drawRects(rects.constData(), int(rects.size()));
0555 }
0556
0557 inline void QPainter::drawPoint(const QPointF &p)
0558 {
0559 drawPoints(&p, 1);
0560 }
0561
0562 inline void QPainter::drawPoint(int x, int y)
0563 {
0564 QPoint p(x, y);
0565 drawPoints(&p, 1);
0566 }
0567
0568 inline void QPainter::drawPoint(const QPoint &p)
0569 {
0570 drawPoints(&p, 1);
0571 }
0572
0573 inline void QPainter::drawPoints(const QPolygonF &points)
0574 {
0575 drawPoints(points.constData(), int(points.size()));
0576 }
0577
0578 inline void QPainter::drawPoints(const QPolygon &points)
0579 {
0580 drawPoints(points.constData(), int(points.size()));
0581 }
0582
0583 inline void QPainter::drawRoundedRect(int x, int y, int w, int h, qreal xRadius, qreal yRadius,
0584 Qt::SizeMode mode)
0585 {
0586 drawRoundedRect(QRectF(x, y, w, h), xRadius, yRadius, mode);
0587 }
0588
0589 inline void QPainter::drawRoundedRect(const QRect &rect, qreal xRadius, qreal yRadius,
0590 Qt::SizeMode mode)
0591 {
0592 drawRoundedRect(QRectF(rect), xRadius, yRadius, mode);
0593 }
0594
0595 inline void QPainter::drawEllipse(int x, int y, int w, int h)
0596 {
0597 drawEllipse(QRect(x, y, w, h));
0598 }
0599
0600 inline void QPainter::drawEllipse(const QPointF ¢er, qreal rx, qreal ry)
0601 {
0602 drawEllipse(QRectF(center.x() - rx, center.y() - ry, 2 * rx, 2 * ry));
0603 }
0604
0605 inline void QPainter::drawEllipse(const QPoint ¢er, int rx, int ry)
0606 {
0607 drawEllipse(QRect(center.x() - rx, center.y() - ry, 2 * rx, 2 * ry));
0608 }
0609
0610 inline void QPainter::drawArc(const QRect &r, int a, int alen)
0611 {
0612 drawArc(QRectF(r), a, alen);
0613 }
0614
0615 inline void QPainter::drawArc(int x, int y, int w, int h, int a, int alen)
0616 {
0617 drawArc(QRectF(x, y, w, h), a, alen);
0618 }
0619
0620 inline void QPainter::drawPie(const QRect &rect, int a, int alen)
0621 {
0622 drawPie(QRectF(rect), a, alen);
0623 }
0624
0625 inline void QPainter::drawPie(int x, int y, int w, int h, int a, int alen)
0626 {
0627 drawPie(QRectF(x, y, w, h), a, alen);
0628 }
0629
0630 inline void QPainter::drawChord(const QRect &rect, int a, int alen)
0631 {
0632 drawChord(QRectF(rect), a, alen);
0633 }
0634
0635 inline void QPainter::drawChord(int x, int y, int w, int h, int a, int alen)
0636 {
0637 drawChord(QRectF(x, y, w, h), a, alen);
0638 }
0639
0640 inline void QPainter::setClipRect(int x, int y, int w, int h, Qt::ClipOperation op)
0641 {
0642 setClipRect(QRect(x, y, w, h), op);
0643 }
0644
0645 inline void QPainter::eraseRect(const QRect &rect)
0646 {
0647 eraseRect(QRectF(rect));
0648 }
0649
0650 inline void QPainter::eraseRect(int x, int y, int w, int h)
0651 {
0652 eraseRect(QRectF(x, y, w, h));
0653 }
0654
0655 inline void QPainter::fillRect(int x, int y, int w, int h, const QBrush &b)
0656 {
0657 fillRect(QRect(x, y, w, h), b);
0658 }
0659
0660 inline void QPainter::fillRect(int x, int y, int w, int h, const QColor &b)
0661 {
0662 fillRect(QRect(x, y, w, h), b);
0663 }
0664
0665 inline void QPainter::fillRect(int x, int y, int w, int h, Qt::GlobalColor c)
0666 {
0667 fillRect(QRect(x, y, w, h), QColor(c));
0668 }
0669
0670 inline void QPainter::fillRect(const QRect &r, Qt::GlobalColor c)
0671 {
0672 fillRect(r, QColor(c));
0673 }
0674
0675 inline void QPainter::fillRect(const QRectF &r, Qt::GlobalColor c)
0676 {
0677 fillRect(r, QColor(c));
0678 }
0679
0680 inline void QPainter::fillRect(int x, int y, int w, int h, Qt::BrushStyle style)
0681 {
0682 fillRect(QRectF(x, y, w, h), QBrush(style));
0683 }
0684
0685 inline void QPainter::fillRect(const QRect &r, Qt::BrushStyle style)
0686 {
0687 fillRect(QRectF(r), QBrush(style));
0688 }
0689
0690 inline void QPainter::fillRect(const QRectF &r, Qt::BrushStyle style)
0691 {
0692 fillRect(r, QBrush(style));
0693 }
0694
0695 inline void QPainter::fillRect(int x, int y, int w, int h, QGradient::Preset p)
0696 {
0697 fillRect(QRect(x, y, w, h), QGradient(p));
0698 }
0699
0700 inline void QPainter::fillRect(const QRect &r, QGradient::Preset p)
0701 {
0702 fillRect(r, QGradient(p));
0703 }
0704
0705 inline void QPainter::fillRect(const QRectF &r, QGradient::Preset p)
0706 {
0707 fillRect(r, QGradient(p));
0708 }
0709
0710 #if QT_GUI_INLINE_IMPL_SINCE(6, 11)
0711
0712 void QPainter::setPen(const QPen &p)
0713 {
0714 doSetPen(p, nullptr);
0715 }
0716
0717 void QPainter::setBrush(const QBrush &b)
0718 {
0719 doSetBrush(b, nullptr);
0720 }
0721
0722 #endif
0723
0724
0725 inline void QPainter::setBrushOrigin(int x, int y)
0726 {
0727 setBrushOrigin(QPoint(x, y));
0728 }
0729
0730 inline void QPainter::setBrushOrigin(const QPoint &p)
0731 {
0732 setBrushOrigin(QPointF(p));
0733 }
0734
0735 inline void QPainter::drawTiledPixmap(const QRect &rect, const QPixmap &pm, const QPoint &offset)
0736 {
0737 drawTiledPixmap(QRectF(rect), pm, QPointF(offset));
0738 }
0739
0740 inline void QPainter::drawTiledPixmap(int x, int y, int w, int h, const QPixmap &pm, int sx, int sy)
0741 {
0742 drawTiledPixmap(QRectF(x, y, w, h), pm, QPointF(sx, sy));
0743 }
0744
0745 inline void QPainter::drawPixmap(const QRect &targetRect, const QPixmap &pixmap, const QRect &sourceRect)
0746 {
0747 drawPixmap(QRectF(targetRect), pixmap, QRectF(sourceRect));
0748 }
0749
0750 inline void QPainter::drawPixmap(const QPoint &p, const QPixmap &pm)
0751 {
0752 drawPixmap(QPointF(p), pm);
0753 }
0754
0755 inline void QPainter::drawPixmap(const QRect &r, const QPixmap &pm)
0756 {
0757 drawPixmap(QRectF(r), pm, QRectF());
0758 }
0759
0760 inline void QPainter::drawPixmap(int x, int y, const QPixmap &pm)
0761 {
0762 drawPixmap(QPointF(x, y), pm);
0763 }
0764
0765 inline void QPainter::drawPixmap(int x, int y, int w, int h, const QPixmap &pm)
0766 {
0767 drawPixmap(QRectF(x, y, w, h), pm, QRectF());
0768 }
0769
0770 inline void QPainter::drawPixmap(int x, int y, int w, int h, const QPixmap &pm,
0771 int sx, int sy, int sw, int sh)
0772 {
0773 drawPixmap(QRectF(x, y, w, h), pm, QRectF(sx, sy, sw, sh));
0774 }
0775
0776 inline void QPainter::drawPixmap(int x, int y, const QPixmap &pm,
0777 int sx, int sy, int sw, int sh)
0778 {
0779 drawPixmap(QRectF(x, y, -1, -1), pm, QRectF(sx, sy, sw, sh));
0780 }
0781
0782 inline void QPainter::drawPixmap(const QPointF &p, const QPixmap &pm, const QRectF &sr)
0783 {
0784 drawPixmap(QRectF(p.x(), p.y(), -1, -1), pm, sr);
0785 }
0786
0787 inline void QPainter::drawPixmap(const QPoint &p, const QPixmap &pm, const QRect &sr)
0788 {
0789 drawPixmap(QRectF(p.x(), p.y(), -1, -1), pm, sr);
0790 }
0791
0792 inline void QPainter::drawTextItem(int x, int y, const QTextItem &ti)
0793 {
0794 drawTextItem(QPointF(x, y), ti);
0795 }
0796
0797 inline void QPainter::drawImage(const QRect &targetRect, const QImage &image, const QRect &sourceRect,
0798 Qt::ImageConversionFlags flags)
0799 {
0800 drawImage(QRectF(targetRect), image, QRectF(sourceRect), flags);
0801 }
0802
0803 inline void QPainter::drawImage(const QPointF &p, const QImage &image, const QRectF &sr,
0804 Qt::ImageConversionFlags flags)
0805 {
0806 drawImage(QRectF(p.x(), p.y(), -1, -1), image, sr, flags);
0807 }
0808
0809 inline void QPainter::drawImage(const QPoint &p, const QImage &image, const QRect &sr,
0810 Qt::ImageConversionFlags flags)
0811 {
0812 drawImage(QRect(p.x(), p.y(), -1, -1), image, sr, flags);
0813 }
0814
0815
0816 inline void QPainter::drawImage(const QRectF &r, const QImage &image)
0817 {
0818 drawImage(r, image, QRect(0, 0, image.width(), image.height()));
0819 }
0820
0821 inline void QPainter::drawImage(const QRect &r, const QImage &image)
0822 {
0823 drawImage(r, image, QRectF(0, 0, image.width(), image.height()));
0824 }
0825
0826 inline void QPainter::drawImage(const QPoint &p, const QImage &image)
0827 {
0828 drawImage(QPointF(p), image);
0829 }
0830
0831 inline void QPainter::drawImage(int x, int y, const QImage &image, int sx, int sy, int sw, int sh,
0832 Qt::ImageConversionFlags flags)
0833 {
0834 if (sx == 0 && sy == 0 && sw == -1 && sh == -1 && flags == Qt::AutoColor)
0835 drawImage(QPointF(x, y), image);
0836 else
0837 drawImage(QRectF(x, y, -1, -1), image, QRectF(sx, sy, sw, sh), flags);
0838 }
0839
0840 inline void QPainter::drawStaticText(const QPoint &p, const QStaticText &staticText)
0841 {
0842 drawStaticText(QPointF(p), staticText);
0843 }
0844
0845 inline void QPainter::drawStaticText(int x, int y, const QStaticText &staticText)
0846 {
0847 drawStaticText(QPointF(x, y), staticText);
0848 }
0849
0850 inline void QPainter::drawTextItem(const QPoint &p, const QTextItem &ti)
0851 {
0852 drawTextItem(QPointF(p), ti);
0853 }
0854
0855 inline void QPainter::drawText(const QPoint &p, const QString &s)
0856 {
0857 drawText(QPointF(p), s);
0858 }
0859
0860 inline void QPainter::drawText(int x, int y, int w, int h, int flags, const QString &str, QRect *br)
0861 {
0862 drawText(QRect(x, y, w, h), flags, str, br);
0863 }
0864
0865 inline void QPainter::drawText(int x, int y, const QString &s)
0866 {
0867 drawText(QPointF(x, y), s);
0868 }
0869
0870 inline QRect QPainter::boundingRect(int x, int y, int w, int h, int flags, const QString &text)
0871 {
0872 return boundingRect(QRect(x, y, w, h), flags, text);
0873 }
0874
0875 inline void QPainter::translate(qreal dx, qreal dy)
0876 {
0877 translate(QPointF(dx, dy));
0878 }
0879
0880 inline void QPainter::translate(const QPoint &offset)
0881 {
0882 translate(offset.x(), offset.y());
0883 }
0884
0885 inline void QPainter::setViewport(int x, int y, int w, int h)
0886 {
0887 setViewport(QRect(x, y, w, h));
0888 }
0889
0890 inline void QPainter::setWindow(int x, int y, int w, int h)
0891 {
0892 setWindow(QRect(x, y, w, h));
0893 }
0894
0895 #ifndef QT_NO_PICTURE
0896 inline void QPainter::drawPicture(int x, int y, const QPicture &p)
0897 {
0898 drawPicture(QPoint(x, y), p);
0899 }
0900
0901 inline void QPainter::drawPicture(const QPoint &pt, const QPicture &p)
0902 {
0903 drawPicture(QPointF(pt), p);
0904 }
0905 #endif
0906
0907 QT_END_NAMESPACE
0908
0909 #endif