Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qdrawutil.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5#ifndef QDRAWUTIL_H
6#define QDRAWUTIL_H
7
8#include <QtWidgets/qtwidgetsglobal.h>
9#include <QtCore/qnamespace.h>
10#include <QtCore/qstring.h> // char*->QString conversion
11#include <QtCore/qmargins.h>
12#include <QtGui/qpixmap.h>
14
15
16class QPainter;
17class QPalette;
18class QPoint;
19class QColor;
20class QBrush;
21class QRect;
22
23//
24// Standard shade drawing
25//
26
27Q_WIDGETS_EXPORT void qDrawShadeLine(QPainter *p, int x1, int y1, int x2, int y2,
28 const QPalette &pal, bool sunken = true,
29 int lineWidth = 1, int midLineWidth = 0);
30
31Q_WIDGETS_EXPORT void qDrawShadeLine(QPainter *p, const QPoint &p1, const QPoint &p2,
32 const QPalette &pal, bool sunken = true,
33 int lineWidth = 1, int midLineWidth = 0);
34
35Q_WIDGETS_EXPORT void qDrawShadeRect(QPainter *p, int x, int y, int w, int h,
36 const QPalette &pal, bool sunken = false,
37 int lineWidth = 1, int midLineWidth = 0,
38 const QBrush *fill = nullptr);
39
40Q_WIDGETS_EXPORT void qDrawShadeRect(QPainter *p, const QRect &r,
41 const QPalette &pal, bool sunken = false,
42 int lineWidth = 1, int midLineWidth = 0,
43 const QBrush *fill = nullptr);
44
45Q_WIDGETS_EXPORT void qDrawShadePanel(QPainter *p, int x, int y, int w, int h,
46 const QPalette &pal, bool sunken = false,
47 int lineWidth = 1, const QBrush *fill = nullptr);
48
49Q_WIDGETS_EXPORT void qDrawShadePanel(QPainter *p, const QRect &r,
50 const QPalette &pal, bool sunken = false,
51 int lineWidth = 1, const QBrush *fill = nullptr);
52
53Q_WIDGETS_EXPORT void qDrawWinButton(QPainter *p, int x, int y, int w, int h,
54 const QPalette &pal, bool sunken = false,
55 const QBrush *fill = nullptr);
56
57Q_WIDGETS_EXPORT void qDrawWinButton(QPainter *p, const QRect &r,
58 const QPalette &pal, bool sunken = false,
59 const QBrush *fill = nullptr);
60
61Q_WIDGETS_EXPORT void qDrawWinPanel(QPainter *p, int x, int y, int w, int h,
62 const QPalette &pal, bool sunken = false,
63 const QBrush *fill = nullptr);
64
65Q_WIDGETS_EXPORT void qDrawWinPanel(QPainter *p, const QRect &r,
66 const QPalette &pal, bool sunken = false,
67 const QBrush *fill = nullptr);
68
69Q_WIDGETS_EXPORT void qDrawPlainRect(QPainter *p, int x, int y, int w, int h, const QColor &,
70 int lineWidth = 1, const QBrush *fill = nullptr);
71
72Q_WIDGETS_EXPORT void qDrawPlainRect(QPainter *p, const QRect &r, const QColor &,
73 int lineWidth = 1, const QBrush *fill = nullptr);
74
75Q_WIDGETS_EXPORT void qDrawPlainRoundedRect(QPainter *p, int x, int y, int w, int h,
76 qreal rx, qreal ry, const QColor &, int lineWidth = 1,
77 const QBrush *fill = nullptr);
78
79inline void qDrawPlainRoundedRect(QPainter *painter, const QRect& rect, qreal rx, qreal ry,
80 const QColor &lineColor, int lineWidth = 1,
81 const QBrush *fill = nullptr)
82{
83 qDrawPlainRoundedRect(painter, rect.x(), rect.y(), rect.width(), rect.height(),
84 rx, ry, lineColor, lineWidth, fill);
85}
86
87
89{
90 inline QTileRules(Qt::TileRule horizontalRule, Qt::TileRule verticalRule)
92 inline QTileRules(Qt::TileRule rule = Qt::StretchTile)
96};
97
98#ifndef Q_QDOC
99// For internal use only.
121#endif
122
123Q_WIDGETS_EXPORT void qDrawBorderPixmap(QPainter *painter,
124 const QRect &targetRect,
125 const QMargins &targetMargins,
126 const QPixmap &pixmap,
127 const QRect &sourceRect,
128 const QMargins &sourceMargins,
129 const QTileRules &rules = QTileRules()
130#ifndef Q_QDOC
131 , QDrawBorderPixmap::DrawingHints hints = QDrawBorderPixmap::DrawingHints()
132#endif
133 );
134
135inline void qDrawBorderPixmap(QPainter *painter,
136 const QRect &target,
137 const QMargins &margins,
138 const QPixmap &pixmap)
139{
140 qDrawBorderPixmap(painter, target, margins, pixmap, pixmap.rect(), margins);
141}
142
143QT_END_NAMESPACE
144
145#endif // QDRAWUTIL_H
friend class QPainter
\inmodule QtCore\reentrant
Definition qpoint.h:29
const quint32 TRANSPARENT_COLOR
const quint32 NO_COLOR
Q_WIDGETS_EXPORT void qDrawPlainRect(QPainter *p, int x, int y, int w, int h, const QColor &, int lineWidth=1, const QBrush *fill=nullptr)
Q_WIDGETS_EXPORT void qDrawShadeRect(QPainter *p, int x, int y, int w, int h, const QPalette &pal, bool sunken=false, int lineWidth=1, int midLineWidth=0, const QBrush *fill=nullptr)
Q_WIDGETS_EXPORT void qDrawWinPanel(QPainter *p, const QRect &r, const QPalette &pal, bool sunken=false, const QBrush *fill=nullptr)
Q_WIDGETS_EXPORT void qDrawShadePanel(QPainter *p, int x, int y, int w, int h, const QPalette &pal, bool sunken=false, int lineWidth=1, const QBrush *fill=nullptr)
Q_WIDGETS_EXPORT void qDrawWinButton(QPainter *p, int x, int y, int w, int h, const QPalette &pal, bool sunken=false, const QBrush *fill=nullptr)
Q_WIDGETS_EXPORT void qDrawShadeRect(QPainter *p, const QRect &r, const QPalette &pal, bool sunken=false, int lineWidth=1, int midLineWidth=0, const QBrush *fill=nullptr)
Q_WIDGETS_EXPORT void qDrawWinButton(QPainter *p, const QRect &r, const QPalette &pal, bool sunken=false, const QBrush *fill=nullptr)
Q_WIDGETS_EXPORT void qDrawPlainRect(QPainter *p, const QRect &r, const QColor &, int lineWidth=1, const QBrush *fill=nullptr)
Q_WIDGETS_EXPORT void qDrawShadeLine(QPainter *p, const QPoint &p1, const QPoint &p2, const QPalette &pal, bool sunken=true, int lineWidth=1, int midLineWidth=0)
void qDrawPlainRoundedRect(QPainter *painter, const QRect &rect, qreal rx, qreal ry, const QColor &lineColor, int lineWidth=1, const QBrush *fill=nullptr)
Definition qdrawutil.h:79
Q_WIDGETS_EXPORT void qDrawShadePanel(QPainter *p, const QRect &r, const QPalette &pal, bool sunken=false, int lineWidth=1, const QBrush *fill=nullptr)
Q_WIDGETS_EXPORT void qDrawShadeLine(QPainter *p, int x1, int y1, int x2, int y2, const QPalette &pal, bool sunken=true, int lineWidth=1, int midLineWidth=0)
Definition qdrawutil.cpp:60
void qDrawBorderPixmap(QPainter *painter, const QRect &target, const QMargins &margins, const QPixmap &pixmap)
Definition qdrawutil.h:135
Q_WIDGETS_EXPORT void qDrawPlainRoundedRect(QPainter *p, int x, int y, int w, int h, qreal rx, qreal ry, const QColor &, int lineWidth=1, const QBrush *fill=nullptr)
Q_WIDGETS_EXPORT void qDrawWinPanel(QPainter *p, int x, int y, int w, int h, const QPalette &pal, bool sunken=false, const QBrush *fill=nullptr)
The QTileRules class provides the rules used to draw a pixmap or image split into nine segments.
Definition qdrawutil.h:89
Qt::TileRule horizontal
Definition qdrawutil.h:94
QTileRules(Qt::TileRule horizontalRule, Qt::TileRule verticalRule)
Constructs a QTileRules with the given horizontalRule and verticalRule.
Definition qdrawutil.h:90
QTileRules(Qt::TileRule rule=Qt::StretchTile)
Constructs a QTileRules with the given rule used for both the horizontal rule and the vertical rule.
Definition qdrawutil.h:92
Qt::TileRule vertical
Definition qdrawutil.h:95