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
qquickrectangle_p.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 QQUICKRECTANGLE_P_H
5#define QQUICKRECTANGLE_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include "qquickitem.h"
19
20#include <QtGui/qbrush.h>
21
22#include <private/qtquickglobal_p.h>
23
25
26class Q_QUICK_EXPORT QQuickPen : public QObject
27{
29
30 Q_PROPERTY(qreal width READ width WRITE setWidth NOTIFY widthChanged FINAL)
32 Q_PROPERTY(bool pixelAligned READ pixelAligned WRITE setPixelAligned NOTIFY pixelAlignedChanged FINAL)
35public:
36 QQuickPen(QObject *parent=nullptr);
37
38 qreal width() const;
39 void setWidth(qreal w);
40
41 QColor color() const;
42 void setColor(const QColor &c);
43
44 bool pixelAligned() const;
45 void setPixelAligned(bool aligned);
46
47 bool isValid() const;
48
50 void widthChanged();
52 void pixelAlignedChanged();
53
55 qreal m_width;
56 QColor m_color;
57 bool m_aligned : 1;
58 bool m_valid : 1;
59};
60
61class Q_QUICK_EXPORT QQuickGradientStop : public QObject
62{
64
67 QML_NAMED_ELEMENT(GradientStop)
69
70public:
71 QQuickGradientStop(QObject *parent=nullptr);
72
73 qreal position() const;
75
76 QColor color() const;
77 void setColor(const QColor &color);
78
80 void updateGradient();
81
83 qreal m_position;
84 QColor m_color;
85};
86
87class Q_QUICK_EXPORT QQuickGradient : public QObject
88{
90
91 Q_PROPERTY(QQmlListProperty<QQuickGradientStop> stops READ stops)
92 Q_PROPERTY(Orientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged REVISION(2, 12))
93 Q_CLASSINFO("DefaultProperty", "stops")
94 QML_NAMED_ELEMENT(Gradient)
97
98public:
99 QQuickGradient(QObject *parent=nullptr);
100 ~QQuickGradient() override;
101
102 enum Orientation { Vertical = Qt::Vertical,
103 Horizontal = Qt::Horizontal };
104 Q_ENUM(Orientation)
105
107
108 Orientation orientation() const { return m_orientation; }
109 void setOrientation(Orientation orientation);
110
111 QGradientStops gradientStops() const;
112
114 void updated();
116
117private:
118 void doUpdate();
119
120private:
121 QList<QQuickGradientStop *> m_stops;
122 Orientation m_orientation = Vertical;
123 friend class QQuickRectangle;
124 friend class QQuickGradientStop;
125};
126
128class Q_QUICK_EXPORT QQuickRectangle : public QQuickItem
129{
131
133 Q_PROPERTY(QJSValue gradient READ gradient WRITE setGradient RESET resetGradient)
135 Q_PROPERTY(qreal radius READ radius WRITE setRadius NOTIFY radiusChanged)
136 Q_PROPERTY(qreal topLeftRadius READ topLeftRadius WRITE setTopLeftRadius NOTIFY topLeftRadiusChanged RESET resetTopLeftRadius REVISION(6, 7) FINAL)
137 Q_PROPERTY(qreal topRightRadius READ topRightRadius WRITE setTopRightRadius NOTIFY topRightRadiusChanged RESET resetTopRightRadius REVISION(6, 7) FINAL)
138 Q_PROPERTY(qreal bottomLeftRadius READ bottomLeftRadius WRITE setBottomLeftRadius NOTIFY bottomLeftRadiusChanged RESET resetBottomLeftRadius REVISION(6, 7) FINAL)
139 Q_PROPERTY(qreal bottomRightRadius READ bottomRightRadius WRITE setBottomRightRadius NOTIFY bottomRightRadiusChanged RESET resetBottomRightRadius REVISION(6, 7) FINAL)
140 QML_NAMED_ELEMENT(Rectangle)
142public:
143 QQuickRectangle(QQuickItem *parent=nullptr);
144
145 QColor color() const;
146 void setColor(const QColor &);
147
149
150 QJSValue gradient() const;
151 void setGradient(const QJSValue &gradient);
152 void resetGradient();
153
154 qreal radius() const;
155 void setRadius(qreal radius);
156
157 qreal topLeftRadius() const;
158 void setTopLeftRadius(qreal radius);
159 void resetTopLeftRadius();
160 qreal topRightRadius() const;
161 void setTopRightRadius(qreal radius);
162 void resetTopRightRadius();
163 qreal bottomLeftRadius() const;
164 void setBottomLeftRadius(qreal radius);
165 void resetBottomLeftRadius();
166 qreal bottomRightRadius() const;
167 void setBottomRightRadius(qreal radius);
168 void resetBottomRightRadius();
169
172 void radiusChanged();
173 Q_REVISION(6, 7) void topLeftRadiusChanged();
174 Q_REVISION(6, 7) void topRightRadiusChanged();
175 Q_REVISION(6, 7) void bottomLeftRadiusChanged();
176 Q_REVISION(6, 7) void bottomRightRadiusChanged();
177
178protected:
179 QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) override;
180
182 void doUpdate();
183
184private:
185 Q_DISABLE_COPY(QQuickRectangle)
186 Q_DECLARE_PRIVATE(QQuickRectangle)
187};
188
190
191#endif // QQUICKRECTANGLE_P_H
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition qcolor.h:31
\inmodule QtGui
Definition qbrush.h:135
The QJSValue class acts as a container for Qt/JavaScript data types.
Definition qjsvalue.h:31
\inmodule QtCore
Definition qobject.h:103
The QQmlListProperty class allows applications to expose list-like properties of QObject-derived clas...
Definition qqmllist.h:24
void orientationChanged()
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
Definition qquickitem.h:63
For specifying a pen used for drawing rectangle borders on a QQuickView.
\group qtquick-scenegraph-nodes \title Qt Quick Scene Graph Node classes
Definition qsgnode.h:37
void colorChanged()
Combined button and popup list for selecting options.
@ Horizontal
Definition qnamespace.h:99
@ Vertical
Definition qnamespace.h:100
n void setPosition(void) \n\
GLfloat GLfloat GLfloat w
[0]
GLint GLenum GLsizei GLsizei GLsizei GLint border
GLint GLsizei width
GLuint color
[2]
const GLubyte * c
#define QML_ANONYMOUS
#define QML_NAMED_ELEMENT(NAME)
#define QML_EXTENDED_NAMESPACE(EXTENDED_NAMESPACE)
#define QML_ADDED_IN_VERSION(MAJOR, MINOR)
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
Int aligned(Int v, Int byteAlign)
#define Q_ENUM(x)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_REVISION(...)
#define Q_CLASSINFO(name, value)
#define Q_SLOTS
#define Q_SIGNALS
double qreal
Definition qtypes.h:187
myFilter setColor(QColor(128, 0, 0))