1 | /**************************************************************************** |
2 | ** |
3 | ** Copyright (C) 2016 The Qt Company Ltd. |
4 | ** Contact: https://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the test suite of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and The Qt Company. For licensing terms |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at https://www.qt.io/contact-us. |
16 | ** |
17 | ** GNU General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU |
19 | ** General Public License version 3 as published by the Free Software |
20 | ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT |
21 | ** included in the packaging of this file. Please review the following |
22 | ** information to ensure the GNU General Public License requirements will |
23 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. |
24 | ** |
25 | ** $QT_END_LICENSE$ |
26 | ** |
27 | ****************************************************************************/ |
28 | #ifndef TESTTYPES_H |
29 | #define TESTTYPES_H |
30 | |
31 | #include <QObject> |
32 | #include <QPoint> |
33 | #include <QPointF> |
34 | #include <QSize> |
35 | #include <QSizeF> |
36 | #include <QRect> |
37 | #include <QRectF> |
38 | #include <QVector2D> |
39 | #include <QVector3D> |
40 | #include <QVector4D> |
41 | #include <QQuaternion> |
42 | #include <QMatrix4x4> |
43 | #include <QFont> |
44 | #include <QColor> |
45 | #include <qqml.h> |
46 | |
47 | class MyTypeObject : public QObject |
48 | { |
49 | Q_OBJECT |
50 | |
51 | Q_PROPERTY(QPoint point READ point WRITE setPoint NOTIFY changed) |
52 | Q_PROPERTY(QPointF pointf READ pointf WRITE setPointf NOTIFY changed) |
53 | Q_PROPERTY(QPointF pointfpoint READ pointfpoint WRITE setPointfpoint NOTIFY changed) |
54 | Q_PROPERTY(QSize size READ size WRITE setSize NOTIFY changed) |
55 | Q_PROPERTY(QSizeF sizef READ sizef WRITE setSizef NOTIFY changed) |
56 | Q_PROPERTY(QSizeF sizefsize READ sizefsize WRITE setSizefsize NOTIFY changed) |
57 | Q_PROPERTY(QSize sizereadonly READ size NOTIFY changed) |
58 | Q_PROPERTY(QRect rect READ rect WRITE setRect NOTIFY changed) |
59 | Q_PROPERTY(QRectF rectf READ rectf WRITE setRectf NOTIFY changed) |
60 | Q_PROPERTY(QRectF rectfrect READ rectfrect WRITE setRectfrect NOTIFY changed) |
61 | Q_PROPERTY(QVector2D vector2 READ vector2 WRITE setVector2 NOTIFY changed) |
62 | Q_PROPERTY(QVector3D vector READ vector WRITE setVector NOTIFY changed) |
63 | Q_PROPERTY(QVector4D vector4 READ vector4 WRITE setVector4 NOTIFY changed) |
64 | Q_PROPERTY(QQuaternion quaternion READ quaternion WRITE setQuaternion NOTIFY changed) |
65 | Q_PROPERTY(QMatrix4x4 matrix READ matrix WRITE setMatrix NOTIFY changed) |
66 | Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY changed) |
67 | Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY changed) |
68 | Q_PROPERTY(QVariant variant READ variant NOTIFY changed) |
69 | |
70 | public: |
71 | MyTypeObject() : |
72 | m_point(10, 4), |
73 | m_pointf(11.3, -10.9), |
74 | m_pointfpoint(10.0, 4.0), |
75 | m_size(1912, 1913), |
76 | m_sizef(0.1, 100923.2), |
77 | m_sizefsize(1912.0, 1913.0), |
78 | m_rect(2, 3, 109, 102), |
79 | m_rectf(103.8, 99.2, 88.1, 77.6), |
80 | m_rectfrect(2.0, 3.0, 109.0, 102.0), |
81 | m_vector2(32.88f, 1.3f), |
82 | m_vector(23.88f, 3.1f, 4.3f), |
83 | m_vector4(54.2f, 23.88f, 3.1f, 4.3f), |
84 | m_quaternion(4.3f, 54.2f, 23.88f, 3.1f), |
85 | m_matrix(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) |
86 | { |
87 | m_font.setFamily("Arial" ); |
88 | m_font.setBold(true); |
89 | m_font.setWeight(QFont::DemiBold); |
90 | m_font.setItalic(true); |
91 | m_font.setUnderline(true); |
92 | m_font.setOverline(true); |
93 | m_font.setStrikeOut(true); |
94 | m_font.setPointSize(29); |
95 | m_font.setCapitalization(QFont::AllLowercase); |
96 | m_font.setLetterSpacing(type: QFont::AbsoluteSpacing, spacing: 10.2); |
97 | m_font.setWordSpacing(19.7); |
98 | m_color.setRedF(0.2); |
99 | m_color.setGreenF(0.88); |
100 | m_color.setBlueF(0.6); |
101 | m_color.setAlphaF(0.34); |
102 | } |
103 | |
104 | QPoint m_point; |
105 | QPoint point() const { return m_point; } |
106 | void setPoint(const QPoint &v) { m_point = v; emit changed(); } |
107 | |
108 | QPointF m_pointf; |
109 | QPointF pointf() const { return m_pointf; } |
110 | void setPointf(const QPointF &v) { m_pointf = v; emit changed(); } |
111 | |
112 | QPointF m_pointfpoint; |
113 | QPointF pointfpoint() const { return m_pointfpoint; } |
114 | void setPointfpoint(const QPointF &v) { m_pointfpoint = v; emit changed(); } |
115 | |
116 | QSize m_size; |
117 | QSize size() const { return m_size; } |
118 | void setSize(const QSize &v) { m_size = v; emit changed(); } |
119 | |
120 | QSizeF m_sizef; |
121 | QSizeF sizef() const { return m_sizef; } |
122 | void setSizef(const QSizeF &v) { m_sizef = v; emit changed(); } |
123 | |
124 | QSizeF m_sizefsize; |
125 | QSizeF sizefsize() const { return m_sizefsize; } |
126 | void setSizefsize(const QSizeF &v) { m_sizefsize = v; emit changed(); } |
127 | |
128 | QRect m_rect; |
129 | QRect rect() const { return m_rect; } |
130 | void setRect(const QRect &v) { m_rect = v; emit changed(); } |
131 | |
132 | QRectF m_rectf; |
133 | QRectF rectf() const { return m_rectf; } |
134 | void setRectf(const QRectF &v) { m_rectf = v; emit changed(); } |
135 | |
136 | QRectF m_rectfrect; |
137 | QRectF rectfrect() const { return m_rectfrect; } |
138 | void setRectfrect(const QRectF &v) { m_rectfrect = v; emit changed(); } |
139 | |
140 | QVector2D m_vector2; |
141 | QVector2D vector2() const { return m_vector2; } |
142 | void setVector2(const QVector2D &v) { m_vector2 = v; emit changed(); } |
143 | |
144 | QVector3D m_vector; |
145 | QVector3D vector() const { return m_vector; } |
146 | void setVector(const QVector3D &v) { m_vector = v; emit changed(); } |
147 | |
148 | QVector4D m_vector4; |
149 | QVector4D vector4() const { return m_vector4; } |
150 | void setVector4(const QVector4D &v) { m_vector4 = v; emit changed(); } |
151 | |
152 | QQuaternion m_quaternion; |
153 | QQuaternion quaternion() const { return m_quaternion; } |
154 | void setQuaternion(const QQuaternion &v) { m_quaternion = v; emit changed(); } |
155 | |
156 | QMatrix4x4 m_matrix; |
157 | QMatrix4x4 matrix() const { return m_matrix; } |
158 | void setMatrix(const QMatrix4x4 &v) { m_matrix = v; emit changed(); } |
159 | |
160 | QFont m_font; |
161 | QFont font() const { return m_font; } |
162 | void setFont(const QFont &v) { m_font = v; emit changed(); } |
163 | |
164 | QColor m_color; |
165 | QColor color() const { return m_color; } |
166 | void setColor(const QColor &v) { m_color = v; emit changed(); } |
167 | |
168 | QVariant variant() const { return sizef(); } |
169 | |
170 | void emitRunScript() { emit runScript(); } |
171 | |
172 | signals: |
173 | void changed(); |
174 | void runScript(); |
175 | |
176 | public slots: |
177 | QSize method() { return QSize(13, 14); } |
178 | }; |
179 | |
180 | void registerTypes(); |
181 | |
182 | #endif // TESTTYPES_H |
183 | |