Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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
4#ifndef QDRAWUTIL_H
5#define QDRAWUTIL_H
6
7#include <QtWidgets/qtwidgetsglobal.h>
8#include <QtCore/qnamespace.h>
9#include <QtCore/qstring.h> // char*->QString conversion
10#include <QtCore/qmargins.h>
11#include <QtGui/qpixmap.h>
13
14
15class QPainter;
16class QPalette;
17class QPoint;
18class QColor;
19class QBrush;
20class QRect;
21
22//
23// Standard shade drawing
24//
25
26Q_WIDGETS_EXPORT void qDrawShadeLine(QPainter *p, int x1, int y1, int x2, int y2,
27 const QPalette &pal, bool sunken = true,
28 int lineWidth = 1, int midLineWidth = 0);
29
30Q_WIDGETS_EXPORT void qDrawShadeLine(QPainter *p, const QPoint &p1, const QPoint &p2,
31 const QPalette &pal, bool sunken = true,
32 int lineWidth = 1, int midLineWidth = 0);
33
34Q_WIDGETS_EXPORT void qDrawShadeRect(QPainter *p, int x, int y, int w, int h,
35 const QPalette &pal, bool sunken = false,
36 int lineWidth = 1, int midLineWidth = 0,
37 const QBrush *fill = nullptr);
38
39Q_WIDGETS_EXPORT void qDrawShadeRect(QPainter *p, const QRect &r,
40 const QPalette &pal, bool sunken = false,
41 int lineWidth = 1, int midLineWidth = 0,
42 const QBrush *fill = nullptr);
43
44Q_WIDGETS_EXPORT void qDrawShadePanel(QPainter *p, int x, int y, int w, int h,
45 const QPalette &pal, bool sunken = false,
46 int lineWidth = 1, const QBrush *fill = nullptr);
47
48Q_WIDGETS_EXPORT void qDrawShadePanel(QPainter *p, const QRect &r,
49 const QPalette &pal, bool sunken = false,
50 int lineWidth = 1, const QBrush *fill = nullptr);
51
52Q_WIDGETS_EXPORT void qDrawWinButton(QPainter *p, int x, int y, int w, int h,
53 const QPalette &pal, bool sunken = false,
54 const QBrush *fill = nullptr);
55
56Q_WIDGETS_EXPORT void qDrawWinButton(QPainter *p, const QRect &r,
57 const QPalette &pal, bool sunken = false,
58 const QBrush *fill = nullptr);
59
60Q_WIDGETS_EXPORT void qDrawWinPanel(QPainter *p, int x, int y, int w, int h,
61 const QPalette &pal, bool sunken = false,
62 const QBrush *fill = nullptr);
63
64Q_WIDGETS_EXPORT void qDrawWinPanel(QPainter *p, const QRect &r,
65 const QPalette &pal, bool sunken = false,
66 const QBrush *fill = nullptr);
67
68Q_WIDGETS_EXPORT void qDrawPlainRect(QPainter *p, int x, int y, int w, int h, const QColor &,
69 int lineWidth = 1, const QBrush *fill = nullptr);
70
71Q_WIDGETS_EXPORT void qDrawPlainRect(QPainter *p, const QRect &r, const QColor &,
72 int lineWidth = 1, const QBrush *fill = nullptr);
73
74Q_WIDGETS_EXPORT void qDrawPlainRoundedRect(QPainter *p, int x, int y, int w, int h,
75 qreal rx, qreal ry, const QColor &, int lineWidth = 1,
76 const QBrush *fill = nullptr);
77
79 const QColor &lineColor, int lineWidth = 1,
80 const QBrush *fill = nullptr)
81{
82 qDrawPlainRoundedRect(painter, rect.x(), rect.y(), rect.width(), rect.height(),
83 rx, ry, lineColor, lineWidth, fill);
84}
85
86
88{
89 inline QTileRules(Qt::TileRule horizontalRule, Qt::TileRule verticalRule)
90 : horizontal(horizontalRule), vertical(verticalRule) {}
95};
96
97#ifndef Q_QDOC
98// For internal use only.
120#endif
121
122Q_WIDGETS_EXPORT void qDrawBorderPixmap(QPainter *painter,
123 const QRect &targetRect,
124 const QMargins &targetMargins,
125 const QPixmap &pixmap,
126 const QRect &sourceRect,
127 const QMargins &sourceMargins,
128 const QTileRules &rules = QTileRules()
129#ifndef Q_QDOC
130 , QDrawBorderPixmap::DrawingHints hints = QDrawBorderPixmap::DrawingHints()
131#endif
132 );
133
135 const QRect &target,
136 const QMargins &margins,
137 const QPixmap &pixmap)
138{
139 qDrawBorderPixmap(painter, target, margins, pixmap, pixmap.rect(), margins);
140}
141
143
144#endif // QDRAWUTIL_H
\inmodule QtGui
Definition qbrush.h:30
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition qcolor.h:31
\inmodule QtCore
Definition qmargins.h:24
The QPainter class performs low-level painting on widgets and other paint devices.
Definition qpainter.h:46
The QPalette class contains color groups for each widget state.
Definition qpalette.h:19
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
Definition qpixmap.h:27
\inmodule QtCore\reentrant
Definition qpoint.h:25
\inmodule QtCore\reentrant
Definition qrect.h:30
QPixmap p2
QPixmap p1
[0]
rect
[4]
Combined button and popup list for selecting options.
TileRule
Definition qnamespace.h:133
@ StretchTile
Definition qnamespace.h:134
DBusConnection const char * rule
Q_WIDGETS_EXPORT void qDrawBorderPixmap(QPainter *painter, const QRect &targetRect, const QMargins &targetMargins, const QPixmap &pixmap, const QRect &sourceRect, const QMargins &sourceMargins, const QTileRules &rules=QTileRules(), QDrawBorderPixmap::DrawingHints hints=QDrawBorderPixmap::DrawingHints())
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:86
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 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 qDrawWinPanel(QPainter *p, int x, int y, int w, int h, 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 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 qDrawPlainRect(QPainter *p, int x, int y, int w, int h, const QColor &, int lineWidth=1, const QBrush *fill=nullptr)
#define Q_DECLARE_FLAGS(Flags, Enum)
Definition qflags.h:174
GLint GLint GLint GLint GLint x
[0]
GLfloat GLfloat GLfloat w
[0]
GLuint GLfloat GLfloat GLfloat GLfloat y1
GLboolean r
[2]
GLuint GLfloat GLfloat GLfloat x1
GLenum target
GLint y
GLfloat GLfloat GLfloat GLfloat h
GLfixed GLfixed GLfixed y2
GLfixed GLfixed x2
GLfloat GLfloat p
[1]
double qreal
Definition qtypes.h:187
ba fill(true)
p ry()++
p rx()++
widget render & pixmap
QPainter painter(this)
[7]
The QTileRules class provides the rules used to draw a pixmap or image split into nine segments.
Definition qdrawutil.h:88
Qt::TileRule horizontal
Definition qdrawutil.h:93
QTileRules(Qt::TileRule horizontalRule, Qt::TileRule verticalRule)
Constructs a QTileRules with the given horizontalRule and verticalRule.
Definition qdrawutil.h:89
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:91
Qt::TileRule vertical
Definition qdrawutil.h:94