OpenCoverage

qquickvaluetypes_p.h

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/util/qquickvaluetypes_p.h
Source codeSwitch to Preprocessed file
LineSourceCount
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 QtQuick module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL$-
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 Lesser General Public License Usage-
18** Alternatively, this file may be used under the terms of the GNU Lesser-
19** General Public License version 3 as published by the Free Software-
20** Foundation and appearing in the file LICENSE.LGPL3 included in the-
21** packaging of this file. Please review the following information to-
22** ensure the GNU Lesser General Public License version 3 requirements-
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
24**-
25** GNU General Public License Usage-
26** Alternatively, this file may be used under the terms of the GNU-
27** General Public License version 2.0 or (at your option) the GNU General-
28** Public license version 3 or any later version approved by the KDE Free-
29** Qt Foundation. The licenses are as published by the Free Software-
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
31** included in the packaging of this file. Please review the following-
32** information to ensure the GNU General Public License requirements will-
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
34** https://www.gnu.org/licenses/gpl-3.0.html.-
35**-
36** $QT_END_LICENSE$-
37**-
38****************************************************************************/-
39-
40#ifndef QQUICKVALUETYPES_P_H-
41#define QQUICKVALUETYPES_P_H-
42-
43//-
44// W A R N I N G-
45// --------------
46//-
47// This file is not part of the Qt API. It exists purely as an-
48// implementation detail. This header file may change from version to-
49// version without notice, or even be removed.-
50//-
51// We mean it.-
52//-
53-
54#include <qqml.h>-
55#include <qtquickglobal.h>-
56#include <private/qqmlvaluetype_p.h>-
57-
58#include <QtGui/QColor>-
59#include <QtGui/QVector2D>-
60#include <QtGui/QVector3D>-
61#include <QtGui/QVector4D>-
62#include <QtGui/QQuaternion>-
63#include <QtGui/QMatrix4x4>-
64#include <QtGui/QFont>-
65-
66QT_BEGIN_NAMESPACE-
67-
68namespace QQuickValueTypes {-
69-
70void registerValueTypes();-
71-
72}-
73-
74class QQuickColorValueType-
75{-
76 QColor v;-
77 Q_PROPERTY(qreal r READ r WRITE setR FINAL)-
78 Q_PROPERTY(qreal g READ g WRITE setG FINAL)-
79 Q_PROPERTY(qreal b READ b WRITE setB FINAL)-
80 Q_PROPERTY(qreal a READ a WRITE setA FINAL)-
81 Q_PROPERTY(qreal hsvHue READ hsvHue WRITE setHsvHue FINAL)-
82 Q_PROPERTY(qreal hsvSaturation READ hsvSaturation WRITE setHsvSaturation FINAL)-
83 Q_PROPERTY(qreal hsvValue READ hsvValue WRITE setHsvValue FINAL)-
84 Q_PROPERTY(qreal hslHue READ hslHue WRITE setHslHue FINAL)-
85 Q_PROPERTY(qreal hslSaturation READ hslSaturation WRITE setHslSaturation FINAL)-
86 Q_PROPERTY(qreal hslLightness READ hslLightness WRITE setHslLightness FINAL)-
87 Q_GADGET-
88public:-
89 Q_INVOKABLE QString toString() const;-
90-
91 qreal r() const;-
92 qreal g() const;-
93 qreal b() const;-
94 qreal a() const;-
95 qreal hsvHue() const;-
96 qreal hsvSaturation() const;-
97 qreal hsvValue() const;-
98 qreal hslHue() const;-
99 qreal hslSaturation() const;-
100 qreal hslLightness() const;-
101 void setR(qreal);-
102 void setG(qreal);-
103 void setB(qreal);-
104 void setA(qreal);-
105 void setHsvHue(qreal);-
106 void setHsvSaturation(qreal);-
107 void setHsvValue(qreal);-
108 void setHslHue(qreal);-
109 void setHslSaturation(qreal);-
110 void setHslLightness(qreal);-
111};-
112-
113class QQuickVector2DValueType-
114{-
115 QVector2D v;-
116 Q_PROPERTY(qreal x READ x WRITE setX FINAL)-
117 Q_PROPERTY(qreal y READ y WRITE setY FINAL)-
118 Q_GADGET-
119public:-
120 Q_INVOKABLE QString toString() const;-
121-
122 qreal x() const;-
123 qreal y() const;-
124 void setX(qreal);-
125 void setY(qreal);-
126-
127 Q_INVOKABLE qreal dotProduct(const QVector2D &vec) const;-
128 Q_INVOKABLE QVector2D times(const QVector2D &vec) const;-
129 Q_INVOKABLE QVector2D times(qreal scalar) const;-
130 Q_INVOKABLE QVector2D plus(const QVector2D &vec) const;-
131 Q_INVOKABLE QVector2D minus(const QVector2D &vec) const;-
132 Q_INVOKABLE QVector2D normalized() const;-
133 Q_INVOKABLE qreal length() const;-
134 Q_INVOKABLE QVector3D toVector3d() const;-
135 Q_INVOKABLE QVector4D toVector4d() const;-
136 Q_INVOKABLE bool fuzzyEquals(const QVector2D &vec, qreal epsilon) const;-
137 Q_INVOKABLE bool fuzzyEquals(const QVector2D &vec) const;-
138};-
139-
140class QQuickVector3DValueType-
141{-
142 QVector3D v;-
143 Q_PROPERTY(qreal x READ x WRITE setX FINAL)-
144 Q_PROPERTY(qreal y READ y WRITE setY FINAL)-
145 Q_PROPERTY(qreal z READ z WRITE setZ FINAL)-
146 Q_GADGET-
147public:-
148 Q_INVOKABLE QString toString() const;-
149-
150 qreal x() const;-
151 qreal y() const;-
152 qreal z() const;-
153 void setX(qreal);-
154 void setY(qreal);-
155 void setZ(qreal);-
156-
157 Q_INVOKABLE QVector3D crossProduct(const QVector3D &vec) const;-
158 Q_INVOKABLE qreal dotProduct(const QVector3D &vec) const;-
159 Q_INVOKABLE QVector3D times(const QMatrix4x4 &m) const;-
160 Q_INVOKABLE QVector3D times(const QVector3D &vec) const;-
161 Q_INVOKABLE QVector3D times(qreal scalar) const;-
162 Q_INVOKABLE QVector3D plus(const QVector3D &vec) const;-
163 Q_INVOKABLE QVector3D minus(const QVector3D &vec) const;-
164 Q_INVOKABLE QVector3D normalized() const;-
165 Q_INVOKABLE qreal length() const;-
166 Q_INVOKABLE QVector2D toVector2d() const;-
167 Q_INVOKABLE QVector4D toVector4d() const;-
168 Q_INVOKABLE bool fuzzyEquals(const QVector3D &vec, qreal epsilon) const;-
169 Q_INVOKABLE bool fuzzyEquals(const QVector3D &vec) const;-
170};-
171-
172class QQuickVector4DValueType-
173{-
174 QVector4D v;-
175 Q_PROPERTY(qreal x READ x WRITE setX FINAL)-
176 Q_PROPERTY(qreal y READ y WRITE setY FINAL)-
177 Q_PROPERTY(qreal z READ z WRITE setZ FINAL)-
178 Q_PROPERTY(qreal w READ w WRITE setW FINAL)-
179 Q_GADGET-
180public:-
181 Q_INVOKABLE QString toString() const;-
182-
183 qreal x() const;-
184 qreal y() const;-
185 qreal z() const;-
186 qreal w() const;-
187 void setX(qreal);-
188 void setY(qreal);-
189 void setZ(qreal);-
190 void setW(qreal);-
191-
192 Q_INVOKABLE qreal dotProduct(const QVector4D &vec) const;-
193 Q_INVOKABLE QVector4D times(const QVector4D &vec) const;-
194 Q_INVOKABLE QVector4D times(const QMatrix4x4 &m) const;-
195 Q_INVOKABLE QVector4D times(qreal scalar) const;-
196 Q_INVOKABLE QVector4D plus(const QVector4D &vec) const;-
197 Q_INVOKABLE QVector4D minus(const QVector4D &vec) const;-
198 Q_INVOKABLE QVector4D normalized() const;-
199 Q_INVOKABLE qreal length() const;-
200 Q_INVOKABLE QVector2D toVector2d() const;-
201 Q_INVOKABLE QVector3D toVector3d() const;-
202 Q_INVOKABLE bool fuzzyEquals(const QVector4D &vec, qreal epsilon) const;-
203 Q_INVOKABLE bool fuzzyEquals(const QVector4D &vec) const;-
204};-
205-
206class QQuickQuaternionValueType-
207{-
208 QQuaternion v;-
209 Q_PROPERTY(qreal scalar READ scalar WRITE setScalar)-
210 Q_PROPERTY(qreal x READ x WRITE setX)-
211 Q_PROPERTY(qreal y READ y WRITE setY)-
212 Q_PROPERTY(qreal z READ z WRITE setZ)-
213 Q_GADGET-
214public:-
215 Q_INVOKABLE QString toString() const;-
216-
217 qreal scalar() const;-
218 qreal x() const;-
219 qreal y() const;-
220 qreal z() const;-
221 void setScalar(qreal);-
222 void setX(qreal);-
223 void setY(qreal);-
224 void setZ(qreal);-
225};-
226-
227class QQuickMatrix4x4ValueType-
228{-
229 QMatrix4x4 v;-
230 Q_PROPERTY(qreal m11 READ m11 WRITE setM11 FINAL)-
231 Q_PROPERTY(qreal m12 READ m12 WRITE setM12 FINAL)-
232 Q_PROPERTY(qreal m13 READ m13 WRITE setM13 FINAL)-
233 Q_PROPERTY(qreal m14 READ m14 WRITE setM14 FINAL)-
234 Q_PROPERTY(qreal m21 READ m21 WRITE setM21 FINAL)-
235 Q_PROPERTY(qreal m22 READ m22 WRITE setM22 FINAL)-
236 Q_PROPERTY(qreal m23 READ m23 WRITE setM23 FINAL)-
237 Q_PROPERTY(qreal m24 READ m24 WRITE setM24 FINAL)-
238 Q_PROPERTY(qreal m31 READ m31 WRITE setM31 FINAL)-
239 Q_PROPERTY(qreal m32 READ m32 WRITE setM32 FINAL)-
240 Q_PROPERTY(qreal m33 READ m33 WRITE setM33 FINAL)-
241 Q_PROPERTY(qreal m34 READ m34 WRITE setM34 FINAL)-
242 Q_PROPERTY(qreal m41 READ m41 WRITE setM41 FINAL)-
243 Q_PROPERTY(qreal m42 READ m42 WRITE setM42 FINAL)-
244 Q_PROPERTY(qreal m43 READ m43 WRITE setM43 FINAL)-
245 Q_PROPERTY(qreal m44 READ m44 WRITE setM44 FINAL)-
246 Q_GADGET-
247public:-
248 qreal m11() const { return v(0, 0); }
executed 10 times by 2 tests: return v(0, 0);
Executed by:
  • tst_qqmlvaluetypeproviders
  • tst_qqmlvaluetypes
10
249 qreal m12() const { return v(0, 1); }
executed 10 times by 2 tests: return v(0, 1);
Executed by:
  • tst_qqmlvaluetypeproviders
  • tst_qqmlvaluetypes
10
250 qreal m13() const { return v(0, 2); }
executed 10 times by 2 tests: return v(0, 2);
Executed by:
  • tst_qqmlvaluetypeproviders
  • tst_qqmlvaluetypes
10
251 qreal m14() const { return v(0, 3); }
executed 10 times by 2 tests: return v(0, 3);
Executed by:
  • tst_qqmlvaluetypeproviders
  • tst_qqmlvaluetypes
10
252 qreal m21() const { return v(1, 0); }
executed 10 times by 2 tests: return v(1, 0);
Executed by:
  • tst_qqmlvaluetypeproviders
  • tst_qqmlvaluetypes
10
253 qreal m22() const { return v(1, 1); }
executed 10 times by 2 tests: return v(1, 1);
Executed by:
  • tst_qqmlvaluetypeproviders
  • tst_qqmlvaluetypes
10
254 qreal m23() const { return v(1, 2); }
executed 10 times by 2 tests: return v(1, 2);
Executed by:
  • tst_qqmlvaluetypeproviders
  • tst_qqmlvaluetypes
10
255 qreal m24() const { return v(1, 3); }
executed 10 times by 2 tests: return v(1, 3);
Executed by:
  • tst_qqmlvaluetypeproviders
  • tst_qqmlvaluetypes
10
256 qreal m31() const { return v(2, 0); }
executed 10 times by 2 tests: return v(2, 0);
Executed by:
  • tst_qqmlvaluetypeproviders
  • tst_qqmlvaluetypes
10
257 qreal m32() const { return v(2, 1); }
executed 10 times by 2 tests: return v(2, 1);
Executed by:
  • tst_qqmlvaluetypeproviders
  • tst_qqmlvaluetypes
10
258 qreal m33() const { return v(2, 2); }
executed 10 times by 2 tests: return v(2, 2);
Executed by:
  • tst_qqmlvaluetypeproviders
  • tst_qqmlvaluetypes
10
259 qreal m34() const { return v(2, 3); }
executed 10 times by 2 tests: return v(2, 3);
Executed by:
  • tst_qqmlvaluetypeproviders
  • tst_qqmlvaluetypes
10
260 qreal m41() const { return v(3, 0); }
executed 10 times by 2 tests: return v(3, 0);
Executed by:
  • tst_qqmlvaluetypeproviders
  • tst_qqmlvaluetypes
10
261 qreal m42() const { return v(3, 1); }
executed 10 times by 2 tests: return v(3, 1);
Executed by:
  • tst_qqmlvaluetypeproviders
  • tst_qqmlvaluetypes
10
262 qreal m43() const { return v(3, 2); }
executed 10 times by 2 tests: return v(3, 2);
Executed by:
  • tst_qqmlvaluetypeproviders
  • tst_qqmlvaluetypes
10
263 qreal m44() const { return v(3, 3); }
executed 10 times by 2 tests: return v(3, 3);
Executed by:
  • tst_qqmlvaluetypeproviders
  • tst_qqmlvaluetypes
10
264-
265 void setM11(qreal value) { v(0, 0) = value; }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qqmlvaluetypes
2
266 void setM12(qreal value) { v(0, 1) = value; }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qqmlvaluetypes
2
267 void setM13(qreal value) { v(0, 2) = value; }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qqmlvaluetypes
2
268 void setM14(qreal value) { v(0, 3) = value; }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qqmlvaluetypes
2
269 void setM21(qreal value) { v(1, 0) = value; }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qqmlvaluetypes
2
270 void setM22(qreal value) { v(1, 1) = value; }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qqmlvaluetypes
2
271 void setM23(qreal value) { v(1, 2) = value; }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qqmlvaluetypes
2
272 void setM24(qreal value) { v(1, 3) = value; }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qqmlvaluetypes
2
273 void setM31(qreal value) { v(2, 0) = value; }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qqmlvaluetypes
2
274 void setM32(qreal value) { v(2, 1) = value; }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qqmlvaluetypes
2
275 void setM33(qreal value) { v(2, 2) = value; }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qqmlvaluetypes
2
276 void setM34(qreal value) { v(2, 3) = value; }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qqmlvaluetypes
2
277 void setM41(qreal value) { v(3, 0) = value; }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qqmlvaluetypes
2
278 void setM42(qreal value) { v(3, 1) = value; }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qqmlvaluetypes
2
279 void setM43(qreal value) { v(3, 2) = value; }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qqmlvaluetypes
2
280 void setM44(qreal value) { v(3, 3) = value; }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qqmlvaluetypes
2
281-
282 Q_INVOKABLE void translate(const QVector3D &t) { v.translate(t); }
never executed: end of block
0
283 Q_INVOKABLE void rotate(float angle, const QVector3D &axis) { v.rotate(angle, axis); }
never executed: end of block
0
284 Q_INVOKABLE void scale(float s) { v.scale(s); }
never executed: end of block
0
285 Q_INVOKABLE void scale(float sx, float sy, float sz) { v.scale(sx, sy, sz); }
never executed: end of block
0
286 Q_INVOKABLE void scale(const QVector3D &s) { v.scale(s); }
never executed: end of block
0
287 Q_INVOKABLE void lookAt(const QVector3D &eye, const QVector3D &center, const QVector3D &up) { v.lookAt(eye, center, up); }
never executed: end of block
0
288-
289 Q_INVOKABLE QMatrix4x4 times(const QMatrix4x4 &m) const;-
290 Q_INVOKABLE QVector4D times(const QVector4D &vec) const;-
291 Q_INVOKABLE QVector3D times(const QVector3D &vec) const;-
292 Q_INVOKABLE QMatrix4x4 times(qreal factor) const;-
293 Q_INVOKABLE QMatrix4x4 plus(const QMatrix4x4 &m) const;-
294 Q_INVOKABLE QMatrix4x4 minus(const QMatrix4x4 &m) const;-
295-
296 Q_INVOKABLE QVector4D row(int n) const;-
297 Q_INVOKABLE QVector4D column(int m) const;-
298-
299 Q_INVOKABLE qreal determinant() const;-
300 Q_INVOKABLE QMatrix4x4 inverted() const;-
301 Q_INVOKABLE QMatrix4x4 transposed() const;-
302-
303 Q_INVOKABLE bool fuzzyEquals(const QMatrix4x4 &m, qreal epsilon) const;-
304 Q_INVOKABLE bool fuzzyEquals(const QMatrix4x4 &m) const;-
305};-
306-
307class QQuickFontValueType-
308{-
309 QFont v;-
310 Q_GADGET-
311-
312 Q_PROPERTY(QString family READ family WRITE setFamily FINAL)-
313 Q_PROPERTY(QString styleName READ styleName WRITE setStyleName FINAL)-
314 Q_PROPERTY(bool bold READ bold WRITE setBold FINAL)-
315 Q_PROPERTY(FontWeight weight READ weight WRITE setWeight FINAL)-
316 Q_PROPERTY(bool italic READ italic WRITE setItalic FINAL)-
317 Q_PROPERTY(bool underline READ underline WRITE setUnderline FINAL)-
318 Q_PROPERTY(bool overline READ overline WRITE setOverline FINAL)-
319 Q_PROPERTY(bool strikeout READ strikeout WRITE setStrikeout FINAL)-
320 Q_PROPERTY(qreal pointSize READ pointSize WRITE setPointSize FINAL)-
321 Q_PROPERTY(int pixelSize READ pixelSize WRITE setPixelSize FINAL)-
322 Q_PROPERTY(Capitalization capitalization READ capitalization WRITE setCapitalization FINAL)-
323 Q_PROPERTY(qreal letterSpacing READ letterSpacing WRITE setLetterSpacing FINAL)-
324 Q_PROPERTY(qreal wordSpacing READ wordSpacing WRITE setWordSpacing FINAL)-
325 Q_PROPERTY(HintingPreference hintingPreference READ hintingPreference WRITE setHintingPreference FINAL)-
326 Q_PROPERTY(bool kerning READ kerning WRITE setKerning FINAL)-
327 Q_PROPERTY(bool preferShaping READ preferShaping WRITE setPreferShaping FINAL)-
328-
329public:-
330 enum FontWeight { Thin = QFont::Thin,-
331 ExtraLight = QFont::ExtraLight,-
332 Light = QFont::Light,-
333 Normal = QFont::Normal,-
334 Medium = QFont::Medium,-
335 DemiBold = QFont::DemiBold,-
336 Bold = QFont::Bold,-
337 ExtraBold = QFont::ExtraBold,-
338 Black = QFont::Black };-
339 Q_ENUM(FontWeight)-
340 enum Capitalization { MixedCase = QFont::MixedCase,-
341 AllUppercase = QFont::AllUppercase,-
342 AllLowercase = QFont::AllLowercase,-
343 SmallCaps = QFont::SmallCaps,-
344 Capitalize = QFont::Capitalize };-
345 Q_ENUM(Capitalization)-
346-
347 enum HintingPreference {-
348 PreferDefaultHinting = QFont::PreferDefaultHinting,-
349 PreferNoHinting = QFont::PreferNoHinting,-
350 PreferVerticalHinting = QFont::PreferVerticalHinting,-
351 PreferFullHinting = QFont::PreferFullHinting-
352 };-
353 Q_ENUM(HintingPreference)-
354-
355 Q_INVOKABLE QString toString() const;-
356-
357 QString family() const;-
358 void setFamily(const QString &);-
359-
360 QString styleName() const;-
361 void setStyleName(const QString &);-
362-
363 bool bold() const;-
364 void setBold(bool b);-
365-
366 FontWeight weight() const;-
367 void setWeight(FontWeight);-
368-
369 bool italic() const;-
370 void setItalic(bool b);-
371-
372 bool underline() const;-
373 void setUnderline(bool b);-
374-
375 bool overline() const;-
376 void setOverline(bool b);-
377-
378 bool strikeout() const;-
379 void setStrikeout(bool b);-
380-
381 qreal pointSize() const;-
382 void setPointSize(qreal size);-
383-
384 int pixelSize() const;-
385 void setPixelSize(int size);-
386-
387 Capitalization capitalization() const;-
388 void setCapitalization(Capitalization);-
389-
390 qreal letterSpacing() const;-
391 void setLetterSpacing(qreal spacing);-
392-
393 qreal wordSpacing() const;-
394 void setWordSpacing(qreal spacing);-
395-
396 HintingPreference hintingPreference() const;-
397 void setHintingPreference(HintingPreference);-
398-
399 bool kerning() const;-
400 void setKerning(bool b);-
401-
402 bool preferShaping() const;-
403 void setPreferShaping(bool b);-
404};-
405-
406QT_END_NAMESPACE-
407-
408#endif // QQUICKVALUETYPES_P_H-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.0