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
qmltypereference.qdoc
Go to the documentation of this file.
1// Copyright (C) 2017 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
4/*!
5\qmlmodule QtQuick
6\title Qt Quick QML Types
7\ingroup qmlmodules
8\brief Provides graphical QML types.
9
10The \l{Qt Quick} module provides graphical primitive types. These types are only
11available in a QML document if that document imports the \c QtQuick namespace.
12
13To use the module, import the \c QtQuick module with the following statement:
14
15\qml
16import QtQuick
17\endqml
18
19Visit the \l {Qt Quick} module documentation for more
20information about the concepts that are central to \c QtQuick.
21
22\section1 Submodules
23
24 Qt Quick includes several submodules that contain additional types:
25
26 \list
27 \li \l{Qt Quick Local Storage QML Types}{Local Storage} - a submodule
28 containing a JavaScript interface for an SQLite database
29 \li \l{Qt Quick Particles QML Types}{Particles} - provides a particle
30 system for QML applications
31 \li \l{Qt Quick Controls QML Types}{Controls} - provides a set of reusable
32 UI components
33 \li \l{Qt Quick Layouts QML Types}{Layouts} - contains types that are used
34 to arrange items in the user interface
35 \li \l{Qt Quick Test QML Types}{Tests} - types for testing QML applications.
36 \li \l{Qt Quick Effects QML Types}{Effects} - provides types for applying
37 one or more simple graphical effects to Qt Quick items.
38 \li \l{Qt Quick Shapes QML Types}{Shapes} - provides types for rendering vector shapes in
39 a Qt Quick scene.
40 \li \l{Qt Quick Vector Image QML Types}{Vector Image} - provides types for displaying vector
41 image files.
42 \endlist
43
44\target value-types
45\section1 Value Types
46
47There are a number of value types that are
48\l{qtqml-typesystem-valuetypes.html#value-types-provided-by-the-qml-language}
49{supported by default in the QML language}.
50
51In addition, the \c QtQuick import provides the following value types:
52\annotatedlist qtquickvaluetypes
53
54\section1 Object Types
55
56Most object types provided by the \c QtQuick import are based on the \l{Item}
57type, which itself derives from \l{QtQml::QtObject}{QtObject}. \l{Qt QML QML
58Types#Object Types} {QML object types} provided by the Qt QML module (such as
59\l{QtQml::QtObject}{QtObject} and \l{QtQml::Component}{Component}) are also
60available when you import \c QtQuick.
61
62*/
63
64/*!
65 \keyword colorvaluetypedocs
66 \qmlvaluetype color
67 \ingroup qtquickvaluetypes
68 \brief an ARGB color value.
69
70 The \c color type refers to an ARGB color value. It can be specified in a number of ways:
71
72 \list
73 \li By a \l{SVG Color Reference}{SVG color name}, such as "red", "green" or "lightsteelblue".
74 \li By a hexadecimal triplet or quad in the form \c "#RRGGBB" and \c "#AARRGGBB"
75 respectively. For example, the color red corresponds to a triplet of \c "#FF0000"
76 and a slightly transparent blue to a quad of \c "#800000FF".
77 \li Using the \l{QtQml::Qt::rgba()}{Qt.rgba()}, \l{QtQml::Qt::hsva()}{Qt.hsva()},
78 \l{QtQml::Qt::hsla()}{Qt.hsla()}, \l{QtQml::Qt::darker()}{Qt.darker()},
79 \l{QtQml::Qt::lighter()}{Qt.lighter()} or \l{QtQml::Qt::tint()}{Qt.tint()} functions.
80 \endlist
81
82 Example:
83
84 \div{float-right}
85 \inlineimage declarative-colors.png
86 \enddiv
87 \snippet qml/colors.qml colors
88
89 A color type has \c r, \c g, \c b and \c a properties that refer to the red,
90 green, blue and alpha values of the color, respectively. Additionally it has
91 \c hsvHue, \c hsvSaturation, \c hsvValue and \c hslHue, \c hslSaturation,
92 \c hslLightness properties, which allow access to color values in HSV and HSL
93 color models accordingly:
94
95 \qml
96 Text {
97 color: "red"
98
99 // prints "1 0 0 1"
100 Component.onCompleted: console.log(color.r, color.g, color.b, color.a)
101 }
102 \endqml
103
104 To test color values for equality, use the \l{QtQml::Qt::colorEqual()}{Qt.colorEqual()}
105 function. This allows colors to be accurately compared whether they are in property
106 form or in any of the acceptable string specification forms.
107
108 When integrating with C++, note that any QColor value
109 \l{qtqml-cppintegration-data.html}{passed into QML from C++} is automatically
110 converted into a \c color value, and vice-versa.
111
112 This value type is provided by the QtQuick import.
113
114 \section1 SVG Color Reference
115
116 The following table lists the available
117 \l {http://www.w3.org/TR/SVG/types.html#ColorKeywords}{SVG colors}:
118
119 \include svg-colors.qdocinc
120
121 \sa {QML Value Types}
122*/
123
124/*!
125 \qmlvaluetype font
126 \ingroup qtquickvaluetypes
127 \brief a font value with the properties of QFont.
128 \target fontvaluetypedocs
129
130 The \c font type refers to a font value with the properties of QFont.
131
132 Properties of type \c font default to the application's default
133 \l {Application::font} {font}.
134
135 The most commonly used properties are:
136
137 \list
138 \li \l string \c font.family
139 \li \l bool \c font.bold
140 \li \l bool \c font.italic
141 \li \l bool \c font.underline
142 \li \l real \c font.pointSize
143 \li \l int \c font.pixelSize
144 \endlist
145
146 If both \c pointSize and a \c pixelSize are specified, \c pixelSize will be used.
147
148 The following properties are also available:
149
150 \list
151 \li \l enumeration \c font.weight
152 \li \l bool \c font.overline
153 \li \l bool \c font.strikeout
154 \li \l enumeration \c font.capitalization
155 \li \l real \c font.letterSpacing
156 \li \l real \c font.wordSpacing
157 \li \l bool \c font.kerning
158 \li \l bool \c font.preferShaping
159 \li \l enumeration \c font.hintingPreference
160 \li \c object \l [QML] {QtQuick::Text::}{font.features}
161 \li \l string \c font.styleName
162 \li \c object \c [QML] {QtQuick::Text::}{font.variableAxes}
163 \endlist
164
165 Example:
166 \qml
167 Text { font.family: "Helvetica"; font.pointSize: 13; font.bold: true }
168 \endqml
169
170 When integrating with C++, note that any QFont value
171 \l{qtqml-cppintegration-data.html}{passed into QML from C++} is automatically
172 converted into a \c font value, and vice-versa.
173
174 This value type is provided by the QtQuick import.
175
176 Numerical values for font weights follow the CSS specification, where a
177 weight of 100 is extremely light, and 900 is extremely bold.
178 The following values are supported:
179
180 \value Font.Thin 100
181 \value Font.ExtraLight 200
182 \value Font.Light 300
183 \value Font.Normal 400
184 \value Font.Medium 500
185 \value Font.DemiBold 600
186 \value Font.Bold 700
187 \value Font.ExtraBold 800
188 \value Font.Black 900
189
190 Capitalization supports the following values:
191
192 \value Font.MixedCase No capitalization change is applied.
193 \value Font.AllUppercase Alters the text to be rendered in all uppercase type.
194 \value Font.AllLowercase Alters the text to be rendered in all lowercase type.
195 \value Font.SmallCaps Alters the text to be rendered in small-caps type.
196 \value Font.Capitalize Alters the text to be rendered with the first character of each word as an uppercase character.
197
198 Setting the hinting preference only has an effect when using the "NativeRendering" render type.
199 The property supports the following values:
200
201 \value Font.PreferDefaultHinting Use the default hinting level for the target platform.
202 \value Font.PreferNoHinting If possible, render text without hinting the outlines of the glyphs.
203 \value Font.PreferVerticalHinting If possible, render text with no horizontal hinting,
204 but align glyphs to the pixel grid in the vertical direction.
205 \value Font.PreferFullHinting If possible, render text with hinting in both horizontal and vertical directions.
206
207 \sa {QML Value Types}
208*/
209
210/*!
211 \qmlvaluetype vector2d
212 \ingroup qtquickvaluetypes
213
214 \brief A vector2d type has x and y attributes.
215
216 A \c vector2d type has \c x and \c y attributes, otherwise
217 it is similar to the \c vector3d type.
218
219 Properties of type \c vector2d have a zero vector as their default value.
220 This has both \c x and \c y set to \c 0.
221
222 See the documentation about the \c vector3d type for more information.
223
224 To create a \c vector2d value, specify it as a "x,y" string,
225 or define the components individually, or compose it with
226 the Qt.vector2d() function.
227
228 The vector2d type has the following idempotent functions which can be
229 invoked in QML:
230 \table 60%
231 \header
232 \li Function Signature
233 \li Description
234 \li Example
235
236 \row
237 \li real dotProduct(vector2d other)
238 \li Returns the scalar real result of the dot product of \c this vector2d with the \c other vector2d
239 \li \code
240var a = Qt.vector2d(1,2);
241var b = Qt.vector2d(3,4);
242var c = a.dotProduct(b);
243console.log(c); // 11
244 \endcode
245
246 \row
247 \li vector2d times(vector2d other)
248 \li Returns the vector2d result of multiplying \c this vector2d with the \c other vector2d
249 \li \code
250var a = Qt.vector2d(1,2);
251var b = Qt.vector2d(3,4);
252var c = a.times(b);
253console.log(c.toString()); // QVector2D(3, 8)
254 \endcode
255
256 \row
257 \li vector2d times(real factor)
258 \li Returns the vector2d result of multiplying \c this vector2d with the scalar \c factor
259 \li \code
260var a = Qt.vector2d(1,2);
261var b = 4.48;
262var c = a.times(b);
263console.log(c.toString()); // QVector2D(4.48, 8.96)
264 \endcode
265
266 \row
267 \li vector2d plus(vector2d other)
268 \li Returns the vector2d result of the addition of \c this vector2d with the \c other vector2d
269 \li \code
270var a = Qt.vector2d(1,2);
271var b = Qt.vector2d(3,4);
272var c = a.plus(b);
273console.log(c.toString()); // QVector2D(4, 6)
274 \endcode
275
276 \row
277 \li vector2d minus(vector2d other)
278 \li Returns the vector2d result of the subtraction of \c other vector2d from \c this vector2d
279 \li \code
280var a = Qt.vector2d(1,2);
281var b = Qt.vector2d(3,4);
282var c = a.minus(b);
283console.log(c.toString()); // QVector2D(-2, -2)
284 \endcode
285
286 \row
287 \li vector2d normalized()
288 \li Returns the normalized form of \c this vector
289 \li \code
290var a = Qt.vector2d(1,2);
291var b = a.normalized();
292console.log(b.toString()); // QVector2D(0.447214, 0.894427)
293 \endcode
294
295 \row
296 \li real length()
297 \li Returns the scalar real value of the length of \c this vector2d
298 \li \code
299var a = Qt.vector2d(1,2);
300var b = a.length();
301console.log(b.toString()); // 2.23606797749979
302 \endcode
303
304 \row
305 \li vector3d toVector3d()
306 \li Returns the vector3d result of converting \c this vector2d to a vector3d
307 \li \code
308var a = Qt.vector2d(1,2);
309var b = a.toVector3d();
310console.log(b.toString()); // QVector3D(1, 2, 0)
311 \endcode
312
313 \row
314 \li vector4d toVector4d()
315 \li Returns the vector4d result of converting \c this vector2d to a vector4d
316 \li \code
317var a = Qt.vector2d(1,2);
318var b = a.toVector4d();
319console.log(b.toString()); // QVector4D(1, 2, 0, 0)
320 \endcode
321
322 \row
323 \li bool fuzzyEquals(vector2d other, real epsilon)
324 \li Returns true if \c this vector2d is approximately equal to the \c other vector2d.
325 The approximation will be true if each attribute of \c this is within \c epsilon
326 of \c other. Note that \c epsilon is an optional argument, the default \c epsilon
327 is 0.00001.
328 \li \code
329var a = Qt.vector2d(1,2);
330var b = Qt.vector2d(1.0001, 1.9998);
331var c = a.fuzzyEquals(b); // default epsilon
332var d = a.fuzzyEquals(b, 0.005); // supplied epsilon
333console.log(c + " " + d); // false true
334 \endcode
335\endtable
336
337 This value type is provided by the QtQuick import.
338
339 \sa {QML Value Types}
340*/
341
342/*!
343 \qmlvaluetype vector3d
344 \ingroup qtquickvaluetypes
345 \brief a value with x, y, and z attributes.
346
347 The \c vector3d type refers to a value with \c x, \c y, and \c z attributes.
348
349 Properties of type \c vector3d have a zero vector by default. This has
350 \c x, \c y and \c z set to \c 0.
351
352 To create a \c vector3d value, specify it as a "x,y,z" string:
353
354 \qml
355 Rotation { angle: 60; axis: "0,1,0" }
356 \endqml
357
358 or with the \l{QtQml::Qt::vector3d()}{Qt.vector3d()} function:
359
360 \qml
361 Rotation { angle: 60; axis: Qt.vector3d(0, 1, 0) }
362 \endqml
363
364 or as separate \c x, \c y, and \c z components:
365
366 \qml
367 Rotation { angle: 60; axis.x: 0; axis.y: 1; axis.z: 0 }
368 \endqml
369
370 Each attribute of a vector3d value is stored internally as a
371 single-precision floating point number (\c float).
372
373 When integrating with C++, note that any QVector3D value
374 \l{qtqml-cppintegration-data.html}{passed into QML from C++} is automatically
375 converted into a \c vector3d value, and vice-versa.
376
377 The vector3d type has the following idempotent functions which can be
378 invoked in QML:
379 \table
380 \header
381 \li Function Signature
382 \li Description
383 \li Example
384
385 \row
386 \li vector3d crossProduct(vector3d other)
387 \li Returns the vector3d result of the cross product of \c this vector3d with the \c other vector3d
388 \li \code
389var a = Qt.vector3d(1,2,3);
390var b = Qt.vector3d(4,5,6);
391var c = a.crossProduct(b);
392console.log(c.toString()); // QVector3D(-3, 6, -3)
393 \endcode
394
395 \row
396 \li real dotProduct(vector3d other)
397 \li Returns the scalar real result of the dot product of \c this vector3d with the \c other vector3d
398 \li \code
399var a = Qt.vector3d(1,2,3);
400var b = Qt.vector3d(4,5,6);
401var c = a.dotProduct(b);
402console.log(c); // 32
403 \endcode
404
405 \row
406 \li vector3d times(matrix4x4 matrix)
407 \li Returns the vector3d result of transforming \c this vector3d with
408 the 4x4 \c matrix with the matrix applied post-vector
409 \li \code
410var a = Qt.vector3d(1,2,3);
411var b = Qt.matrix4x4(4,5,6,7,8,9,10,11,
412 12,13,14,15,16,17,18,19);
413var c = a.times(b);
414console.log(c.toString());
415// QVector3D(0.774194, 0.849462, 0.924731)
416 \endcode
417
418 \row
419 \li vector3d times(vector3d other)
420 \li Returns the vector3d result of multiplying \c this vector3d with the \c other vector3d
421 \li \code
422var a = Qt.vector3d(1,2,3);
423var b = Qt.vector3d(4,5,6);
424var c = a.times(b);
425console.log(c.toString()); // QVector3D(4, 10, 18)
426 \endcode
427
428 \row
429 \li vector3d times(real factor)
430 \li Returns the vector3d result of multiplying \c this vector3d with the scalar \c factor
431 \li \code
432var a = Qt.vector3d(1,2,3);
433var b = 4.48;
434var c = a.times(b);
435console.log(c.toString()); // QVector3D(4.48, 8.96, 13.44)
436 \endcode
437
438 \row
439 \li vector3d plus(vector3d other)
440 \li Returns the vector3d result of the addition of \c this vector3d with the \c other vector3d
441 \li \code
442var a = Qt.vector3d(1,2,3);
443var b = Qt.vector3d(4,5,6);
444var c = a.plus(b);
445console.log(c.toString()); // QVector3D(5, 7, 9)
446 \endcode
447
448 \row
449 \li vector3d minus(vector3d other)
450 \li Returns the vector3d result of the subtraction of \c other vector3d from \c this vector3d
451 \li \code
452var a = Qt.vector3d(1,2,3);
453var b = Qt.vector3d(4,5,6);
454var c = a.minus(b);
455console.log(c.toString()); // QVector3D(-3, -3, -3)
456 \endcode
457
458 \row
459 \li vector3d normalized()
460 \li Returns the normalized form of \c this vector
461 \li \code
462var a = Qt.vector3d(1,2,3);
463var b = a.normalized();
464console.log(b.toString());
465// QVector3D(0.267261, 0.534522, 0.801784)
466 \endcode
467
468 \row
469 \li real length()
470 \li Returns the scalar real value of the length of \c this vector3d
471 \li \code
472var a = Qt.vector3d(1,2,3);
473var b = a.length();
474console.log(b.toString()); // 3.7416573867739413
475 \endcode
476
477 \row
478 \li vector2d toVector2d()
479 \li Returns the vector2d result of converting \c this vector3d to a vector2d
480 \li \code
481var a = Qt.vector3d(1,2,3);
482var b = a.toVector2d();
483console.log(b.toString()); // QVector2D(1, 2)
484 \endcode
485
486 \row
487 \li vector4d toVector4d()
488 \li Returns the vector4d result of converting \c this vector3d to a vector4d
489 \li \code
490var a = Qt.vector3d(1,2,3);
491var b = a.toVector4d();
492console.log(b.toString()); // QVector4D(1, 2, 3, 0)
493 \endcode
494
495 \row
496 \li bool fuzzyEquals(vector3d other, real epsilon)
497 \li Returns true if \c this vector3d is approximately equal to the \c other vector3d.
498 The approximation will be true if each attribute of \c this is within \c epsilon
499 of \c other.
500 Note that \c epsilon is an optional argument, the default \c epsilon
501 is 0.00001.
502 \li \code
503var a = Qt.vector3d(1,2,3);
504var b = Qt.vector3d(1.0001, 1.9998, 2.0001);
505var c = a.fuzzyEquals(b); // default epsilon
506var d = a.fuzzyEquals(b, 0.005); // supplied epsilon
507console.log(c + " " + d); // false true
508 \endcode
509\endtable
510
511 This value type is provided by the QtQuick import.
512
513 \sa {QML Value Types}
514*/
515
516/*!
517 \qmlvaluetype vector4d
518 \ingroup qtquickvaluetypes
519
520 \brief A vector4d type has x, y, z and w attributes.
521
522 A \c vector4d type has \c x, \c y, \c z and \c w attributes,
523 otherwise it is similar to the \c vector3d type.
524
525 Properties of type \c vector4d have a zero vector by default. This has
526 \c x, \c y ,\c z and \c w set to \c 0.
527
528 See the documentation about the \c vector3d type for more information.
529
530 To create a \c vector4d value, specify it as a "x,y,z,w" string,
531 or define the components individually, or compose it with
532 the Qt.vector4d() function.
533
534 The vector4d type has the following idempotent functions which can be
535 invoked in QML:
536 \table
537 \header
538 \li Function Signature
539 \li Description
540 \li Example
541
542 \row
543 \li real dotProduct(vector4d other)
544 \li Returns the scalar real result of the dot product of \c this vector4d with the \c other vector4d
545 \li \code
546var a = Qt.vector4d(1,2,3,4);
547var b = Qt.vector4d(5,6,7,8);
548var c = a.dotProduct(b);
549console.log(c); // 70
550 \endcode
551
552 \row
553 \li vector4d times(matrix4x4 matrix)
554 \li Returns the vector4d result of transforming \c this vector4d with
555 the 4x4 \c matrix with the matrix applied post-vector
556 \li \code
557var a = Qt.vector4d(1,2,3,4);
558var b = Qt.matrix4x4(4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19);
559var c = a.times(b);
560console.log(c.toString()); // QVector4D(120, 130, 140, 150)
561 \endcode
562
563 \row
564 \li vector4d times(vector4d other)
565 \li Returns the vector4d result of multiplying \c this vector4d with the \c other vector4d
566 \li \code
567var a = Qt.vector4d(1,2,3,4);
568var b = Qt.vector4d(5,6,7,8);
569var c = a.times(b);
570console.log(c.toString()); // QVector4D(5, 12, 21, 32)
571 \endcode
572
573 \row
574 \li vector4d times(real factor)
575 \li Returns the vector4d result of multiplying \c this vector4d with the scalar \c factor
576 \li \code
577var a = Qt.vector4d(1,2,3,4);
578var b = 4.48;
579var c = a.times(b);
580console.log(c.toString()); // QVector3D(4.48, 8.96,
581 13.44, 17.92)
582 \endcode
583
584 \row
585 \li vector4d plus(vector4d other)
586 \li Returns the vector4d result of the addition of \c this vector4d with the \c other vector4d
587 \li \code
588var a = Qt.vector4d(1,2,3,4);
589var b = Qt.vector4d(5,6,7,8);
590var c = a.plus(b);
591console.log(c.toString()); // QVector4D(6, 8, 10, 12)
592 \endcode
593
594 \row
595 \li vector4d minus(vector4d other)
596 \li Returns the vector4d result of the subtraction of \c other vector4d from \c this vector4d
597 \li \code
598var a = Qt.vector4d(1,2,3,4);
599var b = Qt.vector4d(5,6,7,8);
600var c = a.minus(b);
601console.log(c.toString()); // QVector4D(-4, -4, -4, -4)
602 \endcode
603
604 \row
605 \li vector4d normalized()
606 \li Returns the normalized form of \c this vector
607 \li \code
608var a = Qt.vector4d(1,2,3,4);
609var b = a.normalized();
610console.log(b.toString());
611// QVector4D(0.182574, 0.365148, 0.547723, 0.730297)
612 \endcode
613
614 \row
615 \li real length()
616 \li Returns the scalar real value of the length of \c this vector3d
617 \li \code
618var a = Qt.vector4d(1,2,3,4);
619var b = a.length();
620console.log(b.toString()); // 5.477225575051661
621 \endcode
622
623 \row
624 \li vector2d toVector2d()
625 \li Returns the vector2d result of converting \c this vector4d to a vector2d
626 \li \code
627var a = Qt.vector4d(1,2,3,4);
628var b = a.toVector2d();
629console.log(b.toString()); // QVector2D(1, 2)
630 \endcode
631
632 \row
633 \li vector3d toVector3d()
634 \li Returns the vector3d result of converting \c this vector4d to a vector3d
635 \li \code
636var a = Qt.vector4d(1,2,3,4);
637var b = a.toVector3d();
638console.log(b.toString()); // QVector3D(1, 2, 3)
639 \endcode
640
641 \row
642 \li bool fuzzyEquals(vector4d other, real epsilon)
643 \li Returns true if \c this vector4d is approximately equal to the \c other vector4d.
644 The approximation will be true if each attribute of \c this is within \c epsilon
645 of \c other. Note that \c epsilon is an optional argument, the default \c epsilon
646 is 0.00001.
647 \li \code
648var a = Qt.vector4d(1,2,3,4);
649var b = Qt.vector4d(1.0001, 1.9998, 2.0001, 3.9999);
650var c = a.fuzzyEquals(b); // default epsilon
651var d = a.fuzzyEquals(b, 0.005); // supplied epsilon
652console.log(c + " " + d); // false true
653 \endcode
654\endtable
655
656 This value type is provided by the QtQuick import.
657
658 \sa {QML Value Types}
659*/
660
661/*!
662 \qmlvaluetype quaternion
663 \ingroup qtquickvaluetypes
664
665 \brief A quaternion type has scalar, x, y, and z attributes.
666
667 A \c quaternion type has \c scalar, \c x, \c y and \c z attributes.
668
669 To create a \c quaternion value, specify it as a "scalar,x,y,z" string,
670 or define the components individually, or compose it with
671 the Qt.quaternion() function.
672
673 The quaternion type has the following idempotent functions which can be
674 invoked in QML:
675 \table
676 \header
677 \li Function Signature
678 \li Description
679 \li Example
680
681 \row
682 \li real dotProduct(quaternion other)
683 \li Returns the scalar real result of the dot product of \c this quaternion with
684 the \c other quaternion
685 \li \code
686var a = Qt.quaternion(1,2,3,4);
687var b = Qt.quaternion(5,6,7,8);
688var c = a.dotProduct(b);
689console.log(c); // 70
690 \endcode
691
692 \row
693 \li quaternion times(quaternion other)
694 \li Returns the quaternion result of multiplying \c this quaternion with
695 the \c other quaternion, which corresponds to applying both of the rotations
696 \li \code
697var a = Qt.quaternion(1 / Math.sqrt(2), 1 / Math.sqrt(2), 0, 0);
698var b = Qt.quaternion(1 / Math.sqrt(2), 0, 1 / Math.sqrt(2), 0);
699var c = b.times(a);
700console.log(c.toString()); // QQuaternion(0.5, 0.5, 0.5, -0.5)
701 \endcode
702
703 \row
704 \li vector3d times(vector3d vector)
705 \li Returns the vector3d result of rotating the \c vector with \c this quaternion
706 \li \code
707var a = Qt.quaternion(0.5,0.5,0.5,-0.5);
708var b = Qt.vector3d(4,5,6);
709var c = a.times(b);
710console.log(c.toString()); // QVector3D(5, -6, -4)
711 \endcode
712
713 \row
714 \li quaternion times(real factor)
715 \li Returns the quaternion result of multiplying \c this quaternion with the scalar
716 \c factor
717 \li \code
718var a = Qt.quaternion(1,2,3,4);
719var b = 4.48;
720var c = a.times(b);
721console.log(c.toString()); // QQuaternion(4.48, 8.96, 13.44, 17.92)
722 \endcode
723
724 \row
725 \li quaternion plus(quaternion other)
726 \li Returns the quaternion result of the addition of \c this quaternion with
727 the \c other quaternion
728 \li \code
729var a = Qt.quaternion(1,2,3,4);
730var b = Qt.quaternion(5,6,7,8);
731var c = a.plus(b);
732console.log(c.toString()); // QQuaternion(6, 8, 10, 12)
733 \endcode
734
735 \row
736 \li quaternion minus(quaternion other)
737 \li Returns the quaternion result of the subtraction of \c other quaternion
738 from \c this quaternion
739 \li \code
740var a = Qt.quaternion(1,2,3,4);
741var b = Qt.quaternion(5,6,7,8);
742var c = a.minus(b);
743console.log(c.toString()); // QQuaternion(-4, -4, -4, -4)
744 \endcode
745
746 \row
747 \li quaternion normalized()
748 \li Returns the normalized unit form of \c this quaternion
749 \li \code
750var a = Qt.quaternion(1,2,3,4);
751var b = a.normalized();
752console.log(b.toString()); // QQuaternion(0.182574, 0.365148, 0.547723, 0.730297)
753 \endcode
754
755 \row
756 \li quaternion inverted()
757 \li Returns the inverse of \c this quaternion
758 \li \code
759var a = Qt.quaternion(0.5,0.5,0.5,-0.5);
760var b = a.inverted();
761console.log(b.toString()); // QQuaternion(0.5, -0.5, -0.5, 0.5)
762 \endcode
763
764 \row
765 \li quaternion conjugated()
766 \li Returns the conjugate of \c this quaternion
767 \li \code
768var a = Qt.quaternion(1,2,3,4);
769var b = a.conjugated()
770console.log(b.toString()); // QQuaternion(1, -2, -3, -4)
771 \endcode
772
773 \row
774 \li real length()
775 \li Returns the scalar real value of the length of \c this quaternion
776 \li \code
777var a = Qt.quaternion(1,2,3,4);
778var b = a.length();
779console.log(b.toString()); // 5.477225575051661
780 \endcode
781
782 \row
783 \li vector3d toEulerAngles()
784 \li Returns the vector3d Euler angles (in degrees) that corresponds to \c this quaternion
785 \li \code
786var a = Qt.quaternion(0.933012,0.25,-0.25,0.066987);
787var b = a.toEulerAngles();
788console.log(b.toString()); // QVector3D(30, -30, -4.28846e-05)
789 \endcode
790
791 \row
792 \li vector4d toVector4d()
793 \li Returns the vector4d result of converting \c this quaternion to a vector4d
794 \li \code
795var a = Qt.quaternion(1,2,3,4);
796var b = a.toVector4d();
797console.log(b.toString()); // QVector4D(2, 3, 4, 1)
798 \endcode
799
800 \row
801 \li bool fuzzyEquals(quaternion other, real epsilon)
802 \li Returns true if \c this quaternion is approximately equal to the \c other quaternion.
803 The approximation will be true if each attribute of \c this is within \c epsilon
804 of \c other.
805 Note that \c epsilon is an optional argument, the default \c epsilon
806 is 0.00001.
807 \li \code
808var a = Qt.quaternion(1,2,3,4);
809var b = Qt.quaternion(1.0001, 1.9998, 2.0001, 3.9999);
810var c = a.fuzzyEquals(b); // default epsilon
811var d = a.fuzzyEquals(b, 0.005); // supplied epsilon
812console.log(c + " " + d); // false true
813 \endcode
814 \endtable
815
816 Properties of type \c quaternion have \c {Qt.quaternion(1, 0, 0, 0)} as their
817 default value.
818
819 This value type is provided by the QtQuick import.
820
821 \sa {QML Value Types}
822*/
823
824/*!
825 \qmlvaluetype matrix4x4
826 \ingroup qtquickvaluetypes
827
828 \brief A matrix4x4 type is a 4-row and 4-column matrix.
829
830 A \c matrix4x4 type has sixteen values, each accessible via the properties
831 \c m11 through \c m44 in QML (in row/column order). Values of this type can
832 be composed with the Qt.matrix4x4() function. Each attribute in a matrix4x4
833 is stored as a real (single-precision on ARM, double-precision on x86).
834
835 A property of type \c matrix4x4 defaults to the identity matrix, whose
836 diagonal entries \c m11, \c m22, \c m33 and \c m44 are all \c 1, with all
837 other components \c 0.
838
839 The matrix4x4 type has the following idempotent functions which can be
840 invoked in QML:
841 \table 70 %
842 \header
843 \li Function Signature
844 \li Description
845 \li Example
846
847 \row
848 \li translate(vector3d vector)
849 \li Multiplies \c this matrix4x4 by another that translates coordinates by the components
850 of \c vector
851 \li \code
852var m = Qt.matrix4x4();
853m.translate(Qt.vector3d(1,2,3));
854console.log(m.toString());
855// QMatrix4x4(1, 0, 0, 1, 0, 1, 0, 2, 0, 0, 1, 3, 0, 0, 0, 1)
856 \endcode
857
858 \row
859 \li rotate(real angle, vector3d axis)
860 \li Multiples \c this matrix4x4 by another that rotates coordinates through
861 \c angle degrees about \c axis
862 \li \code
863var m = Qt.matrix4x4();
864m.rotate(180,Qt.vector3d(1,0,0));
865console.log(m.toString());
866// QMatrix4x4(1, 0, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1)
867 \endcode
868
869 \row
870 \li rotate(quaternion quaternion)
871 \li Multiples \c this matrix4x4 by another that rotates coordinates according to
872 a specified \c quaternion. The \c quaternion is assumed to have been normalized.
873 \li \code
874var m = Qt.matrix4x4();
875m.rotate(Qt.quaternion(0.5,0.5,0.5,-0.5));
876console.log(m.toString());
877// QMatrix4x4(0, 1, 0, 0, 0, 0, -1, 0, -1, 0, 0, 0, 0, 0, 0, 1)
878 \endcode
879
880 \row
881 \li scale(real factor)
882 \li Multiplies \c this matrix4x4 by another that scales coordinates by the given \c factor
883 \li \code
884var m = Qt.matrix4x4();
885m.scale(2);
886console.log(m.toString());
887// QMatrix4x4(2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 1)
888 \endcode
889
890 \row
891 \li scale(real x, real y, real z)
892 \li Multiplies \c this matrix4x4 by another that scales coordinates by the components
893 \c x, \c y, and \c z
894 \li \code
895var m = Qt.matrix4x4();
896m.scale(1,2,3);
897console.log(m.toString());
898// QMatrix4x4(1, 0, 0, 0, 0, 2, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1)
899 \endcode
900
901 \row
902 \li scale(vector3d vector)
903 \li Multiplies \c this matrix4x4 by another that scales coordinates by the components
904 of \c vector
905 \li \code
906var m = Qt.matrix4x4();
907m.scale(Qt.vector3d(1,2,3));
908console.log(m.toString());
909// QMatrix4x4(1, 0, 0, 0, 0, 2, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1)
910 \endcode
911
912 \row
913 \li lookAt(vector3d eye, vector3d center, vector3d up)
914 \li Multiplies \c this matrix4x4 by a viewing matrix derived from an \c eye point.
915 The \c center vector3d indicates the center of the view that the \c eye is looking at.
916 The \c up vector3d indicates which direction should be considered up with respect to
917 the \c eye.
918 \li \code
919var m = Qt.matrix4x4();
920m.lookAt(Qt.vector3d(1,2,3),Qt.vector3d(1,2,0),Qt.vector3d(0,1,0));
921console.log(m.toString());
922// QMatrix4x4(1, 0, 0, -1, 0, 1, 0, -2, 0, 0, 1, -3, 0, 0, 0, 1)
923 \endcode
924
925 \row
926 \li matrix4x4 times(matrix4x4 other)
927 \li Returns the matrix4x4 result of multiplying \c this matrix4x4 with
928 the \c other matrix4x4
929 \li \code
930var a = Qt.matrix4x4(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16);
931var b = Qt.matrix4x4(4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19);
932var c = a.times(b);
933console.log(c.toString());
934// QMatrix4x4(120, 130, 140, 150, 280, 306, 332, 358, 440, 482,
935//524, 566, 600, 658, 716, 774)
936 \endcode
937
938 \row
939 \li vector4d times(vector4d vector)
940 \li Returns the vector4d result of transforming the \c vector
941 according to \c this matrix4x4 with the matrix applied
942 pre-vector
943 \li \code
944var a = Qt.matrix4x4(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16);
945var b = Qt.vector4d(5,6,7,8);
946var c = a.times(b);
947console.log(c.toString()); // QVector4D(70, 174, 278, 382)
948 \endcode
949
950 \row
951 \li vector3d times(vector3d vector)
952 \li Returns the vector3d result of transforming the \c vector
953 according to \c this matrix4x4 with the matrix applied
954 pre-vector
955 \li \code
956var a = Qt.matrix4x4(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16);
957var b = Qt.vector3d(5,6,7);
958var c = a.times(b);
959console.log(c.toString()); // QVector3D(0.155556, 0.437037, 0.718518)
960 \endcode
961
962 \row
963 \li matrix4x4 times(real factor)
964 \li Returns the matrix4x4 result of multiplying \c this matrix4x4 with the scalar \c factor
965 \li \code
966var a = Qt.matrix4x4(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16);
967var b = 4.48;
968var c = a.times(b);
969console.log(c.toString());
970// QMatrix4x4(4.48, 8.96, 13.44, 17.92, 22.4, 26.88, 31.36, 35.84,
971// 40.32, 44.8, 49.28, 53.76, 58.24, 62.72, 67.2, 71.68)
972 \endcode
973
974 \row
975 \li matrix4x4 plus(matrix4x4 other)
976 \li Returns the matrix4x4 result of the addition of \c this matrix4x4 with the \c other matrix4x4
977 \li \code
978var a = Qt.matrix4x4(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16);
979var b = Qt.matrix4x4(5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20);
980var c = a.plus(b);
981console.log(c.toString());
982// QMatrix4x4(6, 8, 10, 12, 14, 16, 18, 20, 22,
983// 24, 26, 28, 30, 32, 34, 36)
984 \endcode
985
986 \row
987 \li matrix4x4 minus(matrix4x4 other)
988 \li Returns the matrix4x4 result of the subtraction of \c other matrix4x4 from \c this matrix4x4
989 \li \code
990var a = Qt.matrix4x4(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16);
991var b = Qt.matrix4x4(5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20);
992var c = a.minus(b);
993console.log(c.toString());
994// QMatrix4x4(-4, -4, -4, -4, -4, -4, -4, -4, -4,
995// -4, -4, -4, -4, -4, -4, -4)
996 \endcode
997
998 \row
999 \li vector4d row(int which)
1000 \li Returns the vector4d row of \c this specified by \c which.
1001 Note: the \c which is 0-based access into the matrix.
1002 \li \code
1003var a = Qt.matrix4x4(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16);
1004var b = Qt.vector4d(a.m21, a.m22, a.m23, a.m24);
1005var c = a.row(2); // zero based access! so not equal to b
1006console.log(b.toString() + " " + c.toString());
1007// QVector4D(5, 6, 7, 8) QVector4D(9, 10, 11, 12)
1008 \endcode
1009
1010 \row
1011 \li vector4d column(int which)
1012 \li Returns the vector4d column of \c this specified by \c which.
1013 Note: the \c which is 0-based access into the matrix.
1014 \li \code
1015var a = Qt.matrix4x4(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16);
1016var b = Qt.vector4d(a.m12, a.m22, a.m32, a.m42);
1017var c = a.column(2); // zero based access! so not equal to b
1018console.log(b.toString() + " " + c.toString());
1019// QVector4D(2, 6, 10, 14) QVector4D(3, 7, 11, 15)
1020 \endcode
1021
1022 \row
1023 \li real determinant()
1024 \li Returns the determinant of \c this matrix4x4
1025 \li \code
1026var a = Qt.matrix4x4(1,0,0,0,0,2,0,0,0,0,3,0,100,200,300,1);
1027var b = a.determinant();
1028console.log(b); // 6
1029 \endcode
1030
1031 \row
1032 \li matrix4x4 inverted()
1033 \li Returns the inverse of \c this matrix4x4 if it exists, else the identity matrix.
1034 \li \code
1035var a = Qt.matrix4x4(1,0,0,0,0,2,0,0,0,0,3,0,100,200,300,1);
1036var b = a.inverted();
1037console.log(b.toString());
1038// QMatrix4x4(1, 0, 0, 0, 0, 0.5, 0, 0, 0, 0, 0.333333, 0, -100,
1039// -100, -100, 1)
1040 \endcode
1041
1042 \row
1043 \li matrix4x4 transposed()
1044 \li Returns the transpose of \c this matrix4x4
1045 \li \code
1046var a = Qt.matrix4x4(1,0,0,0,0,2,0,0,0,0,3,0,100,200,300,1);
1047var b = a.transposed();
1048console.log(b.toString());
1049// QMatrix4x4(1, 0, 0, 100, 0, 2, 0, 200, 0, 0, 3, 300, 0, 0, 0, 1)
1050 \endcode
1051
1052 \row
1053 \li rect mapRect(rect)
1054 \li Maps the provided rectangle into the coordinate system defined by this matrix.
1055 If rotation or shearing has been specified, this function returns the bounding rectangle.
1056 This function was introduced in Qt 6.5.
1057 \li \code
1058var a = Qt.matrix4x4(2,0,0,0,0,2,0,0,0,0,1,0,0,0,0,1);
1059var b = a.mapRect(Qt.rect(10, 20, 30, 40));
1060console.log(b.toString());
1061// Qt.rect(20, 40, 60, 80)
1062 \endcode
1063
1064 \row
1065 \li point map(point)
1066 \li Maps the provided point into the coordinate system defined by this matrix.
1067 This function was introduced in Qt 6.5.
1068 \li \code
1069var a = Qt.matrix4x4(2,0,0,0,0,2,0,0,0,0,1,0,0,0,0,1);
1070var b = a.map(10, 20);
1071console.log(b.toString());
1072// Qt.point(20, 40)
1073 \endcode
1074
1075 \row
1076 \li bool fuzzyEquals(matrix4x4 other, real epsilon)
1077 \li Returns true if \c this matrix4x4 is approximately equal to the \c other matrix4x4.
1078 The approximation will be true if each attribute of \c this is within \c epsilon
1079 of the respective attribute of \c other. Note that \c epsilon is an optional
1080 argument, the default \c epsilon is 0.00001.
1081 \li \code
1082var a = Qt.matrix4x4(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16);
1083var b = Qt.matrix4x4(1.0001,2.0001,3.0002,4.0003,5.0001,6.0002,
1084 7.0002,8.0004, 9.0001,10.0003,
1085 11.0003,12.0004,13.0001,
1086 14.0002,15.0003,16.0004);
1087var c = a.fuzzyEquals(b); // default epsilon
1088var d = a.fuzzyEquals(b, 0.005); // supplied epsilon
1089console.log(c + " " + d); // false true
1090 \endcode
1091\endtable
1092
1093 This value type is provided by the QtQuick import.
1094
1095 \sa {QML Value Types}
1096*/