Qt 6.x
The Qt SDK
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
74
75
77{
78 inline QTileRules(Qt::TileRule horizontalRule, Qt::TileRule verticalRule)
79 : horizontal(horizontalRule), vertical(verticalRule) {}
84};
85
86#ifndef Q_QDOC
87// For internal use only.
89{
91 {
92 OpaqueTopLeft = 0x0001,
93 OpaqueTop = 0x0002,
95 OpaqueLeft = 0x0008,
96 OpaqueCenter = 0x0010,
97 OpaqueRight = 0x0020,
99 OpaqueBottom = 0x0080,
105 };
106
107 Q_DECLARE_FLAGS(DrawingHints, DrawingHint)
108}
109#endif
110
111Q_WIDGETS_EXPORT void qDrawBorderPixmap(QPainter *painter,
112 const QRect &targetRect,
113 const QMargins &targetMargins,
114 const QPixmap &pixmap,
115 const QRect &sourceRect,
116 const QMargins &sourceMargins,
117 const QTileRules &rules = QTileRules()
118#ifndef Q_QDOC
119 , QDrawBorderPixmap::DrawingHints hints = QDrawBorderPixmap::DrawingHints()
120#endif
121 );
122
124 const QRect &target,
125 const QMargins &margins,
126 const QPixmap &pixmap)
127{
128 qDrawBorderPixmap(painter, target, margins, pixmap, pixmap.rect(), margins);
129}
130
132
133#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:23
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:23
\inmodule QtCore\reentrant
Definition qrect.h:30
QPixmap p2
QPixmap p1
[0]
Combined button and popup list for selecting options.
TileRule
Definition qnamespace.h:132
@ StretchTile
Definition qnamespace.h:133
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 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]
ba fill(true)
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:77
Qt::TileRule horizontal
Definition qdrawutil.h:82
QTileRules(Qt::TileRule horizontalRule, Qt::TileRule verticalRule)
Constructs a QTileRules with the given horizontalRule and verticalRule.
Definition qdrawutil.h:78
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:80
Qt::TileRule vertical
Definition qdrawutil.h:83