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