145a8e3302f47a32583a652eabdf526aa7e413a0
[profile/ivi/qtdeclarative.git] / src / declarative / qml / qdeclarativevaluetype_p.h
1 /****************************************************************************
2 **
3 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: http://www.qt-project.org/
6 **
7 ** This file is part of the QtDeclarative module of the Qt Toolkit.
8 **
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** GNU Lesser General Public License Usage
11 ** This file may be used under the terms of the GNU Lesser General Public
12 ** License version 2.1 as published by the Free Software Foundation and
13 ** appearing in the file LICENSE.LGPL included in the packaging of this
14 ** file. Please review the following information to ensure the GNU Lesser
15 ** General Public License version 2.1 requirements will be met:
16 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
17 **
18 ** In addition, as a special exception, Nokia gives you certain additional
19 ** rights. These rights are described in the Nokia Qt LGPL Exception
20 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
21 **
22 ** GNU General Public License Usage
23 ** Alternatively, this file may be used under the terms of the GNU General
24 ** Public License version 3.0 as published by the Free Software Foundation
25 ** and appearing in the file LICENSE.GPL included in the packaging of this
26 ** file. Please review the following information to ensure the GNU General
27 ** Public License version 3.0 requirements will be met:
28 ** http://www.gnu.org/copyleft/gpl.html.
29 **
30 ** Other Usage
31 ** Alternatively, this file may be used in accordance with the terms and
32 ** conditions contained in a signed written agreement between you and Nokia.
33 **
34 **
35 **
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41
42 #ifndef QDECLARATIVEVALUETYPE_P_H
43 #define QDECLARATIVEVALUETYPE_P_H
44
45 //
46 //  W A R N I N G
47 //  -------------
48 //
49 // This file is not part of the Qt API.  It exists purely as an
50 // implementation detail.  This header file may change from version to
51 // version without notice, or even be removed.
52 //
53 // We mean it.
54 //
55
56 #include "qdeclarativeproperty.h"
57 #include "qdeclarativeproperty_p.h"
58 #include "qdeclarativenullablevalue_p_p.h"
59
60 #include <QtCore/qobject.h>
61 #include <QtCore/qrect.h>
62 #include <QtCore/qeasingcurve.h>
63 #include <QtCore/qvariant.h>
64 #include <QtGui/qvector2d.h>
65 #include <QtGui/qvector3d.h>
66 #include <QtGui/qvector4d.h>
67 #include <QtGui/qmatrix4x4.h>
68 #include <QtGui/qquaternion.h>
69 #include <QtGui/qfont.h>
70 #include <QtGui/qcolor.h>
71
72 QT_BEGIN_NAMESPACE
73
74 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeValueType : public QObject
75 {
76     Q_OBJECT
77 public:
78     QDeclarativeValueType(QObject *parent = 0);
79     virtual void read(QObject *, int) = 0;
80     virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags flags) = 0;
81     virtual QVariant value() = 0;
82     virtual void setValue(const QVariant &) = 0;
83
84     virtual QString toString() const = 0;
85     virtual bool isEqual(const QVariant &value) const = 0;
86
87     inline void onLoad();
88 };
89
90 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeValueTypeFactory
91 {
92 public:
93     QDeclarativeValueTypeFactory();
94     ~QDeclarativeValueTypeFactory();
95     static bool isValueType(int);
96     static QDeclarativeValueType *valueType(int);
97
98     static void registerBaseTypes(const char *uri, int versionMajor, int versionMinor);
99     static void registerValueTypes();
100
101     QDeclarativeValueType *operator[](int idx) const {
102         if (idx >= (int)QVariant::UserType) return 0;
103         else return valueTypes[idx];
104     }
105
106 private:
107     QDeclarativeValueType *valueTypes[QVariant::UserType - 1]; 
108 };
109
110 // Exported for QtQuick1
111 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativePointFValueType : public QDeclarativeValueType
112 {
113     Q_PROPERTY(qreal x READ x WRITE setX)
114     Q_PROPERTY(qreal y READ y WRITE setY)
115     Q_OBJECT
116 public:
117     QDeclarativePointFValueType(QObject *parent = 0);
118
119     virtual void read(QObject *, int);
120     virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags);
121     virtual QVariant value();
122     virtual void setValue(const QVariant &value);
123     virtual QString toString() const;
124     virtual bool isEqual(const QVariant &value) const;
125
126     qreal x() const;
127     qreal y() const;
128     void setX(qreal);
129     void setY(qreal);
130
131 private:
132     QPointF point;
133 };
134
135 // Exported for QtQuick1
136 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativePointValueType : public QDeclarativeValueType
137 {
138     Q_PROPERTY(int x READ x WRITE setX)
139     Q_PROPERTY(int y READ y WRITE setY)
140     Q_OBJECT
141 public:
142     QDeclarativePointValueType(QObject *parent = 0);
143
144     virtual void read(QObject *, int);
145     virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags);
146     virtual QVariant value();
147     virtual void setValue(const QVariant &value);
148     virtual QString toString() const;
149     virtual bool isEqual(const QVariant &value) const;
150
151     int x() const;
152     int y() const;
153     void setX(int);
154     void setY(int);
155
156 private:
157     QPoint point;
158 };
159
160 // Exported for QtQuick1
161 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeSizeFValueType : public QDeclarativeValueType
162 {
163     Q_PROPERTY(qreal width READ width WRITE setWidth)
164     Q_PROPERTY(qreal height READ height WRITE setHeight)
165     Q_OBJECT
166 public:
167     QDeclarativeSizeFValueType(QObject *parent = 0);
168
169     virtual void read(QObject *, int);
170     virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags);
171     virtual QVariant value();
172     virtual void setValue(const QVariant &value);
173     virtual QString toString() const;
174     virtual bool isEqual(const QVariant &value) const;
175
176     qreal width() const;
177     qreal height() const;
178     void setWidth(qreal);
179     void setHeight(qreal);
180
181 private:
182     QSizeF size;
183 };
184
185 // Exported for QtQuick1
186 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeSizeValueType : public QDeclarativeValueType
187 {
188     Q_PROPERTY(int width READ width WRITE setWidth)
189     Q_PROPERTY(int height READ height WRITE setHeight)
190     Q_OBJECT
191 public:
192     QDeclarativeSizeValueType(QObject *parent = 0);
193
194     virtual void read(QObject *, int);
195     virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags);
196     virtual QVariant value();
197     virtual void setValue(const QVariant &value);
198     virtual QString toString() const;
199     virtual bool isEqual(const QVariant &value) const;
200
201     int width() const;
202     int height() const;
203     void setWidth(int);
204     void setHeight(int);
205
206 private:
207     QSize size;
208 };
209
210 // Exported for QtQuick1
211 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeRectFValueType : public QDeclarativeValueType
212 {
213     Q_PROPERTY(qreal x READ x WRITE setX)
214     Q_PROPERTY(qreal y READ y WRITE setY)
215     Q_PROPERTY(qreal width READ width WRITE setWidth)
216     Q_PROPERTY(qreal height READ height WRITE setHeight)
217     Q_OBJECT
218 public:
219     QDeclarativeRectFValueType(QObject *parent = 0);
220
221     virtual void read(QObject *, int);
222     virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags);
223     virtual QVariant value();
224     virtual void setValue(const QVariant &value);
225     virtual QString toString() const;
226     virtual bool isEqual(const QVariant &value) const;
227
228     qreal x() const;
229     qreal y() const;
230     void setX(qreal);
231     void setY(qreal);
232     
233     qreal width() const;
234     qreal height() const;
235     void setWidth(qreal);
236     void setHeight(qreal);
237
238 private:
239     QRectF rect;
240 };
241
242 // Exported for QtQuick1
243 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeRectValueType : public QDeclarativeValueType
244 {
245     Q_PROPERTY(int x READ x WRITE setX)
246     Q_PROPERTY(int y READ y WRITE setY)
247     Q_PROPERTY(int width READ width WRITE setWidth)
248     Q_PROPERTY(int height READ height WRITE setHeight)
249     Q_OBJECT
250 public:
251     QDeclarativeRectValueType(QObject *parent = 0);
252
253     virtual void read(QObject *, int);
254     virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags);
255     virtual QVariant value();
256     virtual void setValue(const QVariant &value);
257     virtual QString toString() const;
258     virtual bool isEqual(const QVariant &value) const;
259
260     int x() const;
261     int y() const;
262     void setX(int);
263     void setY(int);
264     
265     int width() const;
266     int height() const;
267     void setWidth(int);
268     void setHeight(int);
269
270 private:
271     QRect rect;
272 };
273
274 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeVector2DValueType : public QDeclarativeValueType
275 {
276     Q_PROPERTY(qreal x READ x WRITE setX)
277     Q_PROPERTY(qreal y READ y WRITE setY)
278     Q_OBJECT
279 public:
280     QDeclarativeVector2DValueType(QObject *parent = 0);
281
282     virtual void read(QObject *, int);
283     virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags);
284     virtual QVariant value();
285     virtual void setValue(const QVariant &value);
286     virtual QString toString() const;
287     virtual bool isEqual(const QVariant &value) const;
288
289     qreal x() const;
290     qreal y() const;
291     void setX(qreal);
292     void setY(qreal);
293
294 private:
295     QVector2D vector;
296 };
297
298 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeVector3DValueType : public QDeclarativeValueType
299 {
300     Q_PROPERTY(qreal x READ x WRITE setX)
301     Q_PROPERTY(qreal y READ y WRITE setY)
302     Q_PROPERTY(qreal z READ z WRITE setZ)
303     Q_OBJECT
304 public:
305     QDeclarativeVector3DValueType(QObject *parent = 0);
306
307     virtual void read(QObject *, int);
308     virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags);
309     virtual QVariant value();
310     virtual void setValue(const QVariant &value);
311     virtual QString toString() const;
312     virtual bool isEqual(const QVariant &value) const;
313
314     qreal x() const;
315     qreal y() const;
316     qreal z() const;
317     void setX(qreal);
318     void setY(qreal);
319     void setZ(qreal);
320
321 private:
322     QVector3D vector;
323 };
324
325 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeVector4DValueType : public QDeclarativeValueType
326 {
327     Q_PROPERTY(qreal x READ x WRITE setX)
328     Q_PROPERTY(qreal y READ y WRITE setY)
329     Q_PROPERTY(qreal z READ z WRITE setZ)
330     Q_PROPERTY(qreal w READ w WRITE setW)
331     Q_OBJECT
332 public:
333     QDeclarativeVector4DValueType(QObject *parent = 0);
334
335     virtual void read(QObject *, int);
336     virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags);
337     virtual QVariant value();
338     virtual void setValue(const QVariant &value);
339     virtual QString toString() const;
340     virtual bool isEqual(const QVariant &value) const;
341
342     qreal x() const;
343     qreal y() const;
344     qreal z() const;
345     qreal w() const;
346     void setX(qreal);
347     void setY(qreal);
348     void setZ(qreal);
349     void setW(qreal);
350
351 private:
352     QVector4D vector;
353 };
354
355 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeQuaternionValueType : public QDeclarativeValueType
356 {
357     Q_PROPERTY(qreal scalar READ scalar WRITE setScalar)
358     Q_PROPERTY(qreal x READ x WRITE setX)
359     Q_PROPERTY(qreal y READ y WRITE setY)
360     Q_PROPERTY(qreal z READ z WRITE setZ)
361     Q_OBJECT
362 public:
363     QDeclarativeQuaternionValueType(QObject *parent = 0);
364
365     virtual void read(QObject *, int);
366     virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags);
367     virtual QVariant value();
368     virtual void setValue(const QVariant &value);
369     virtual QString toString() const;
370     virtual bool isEqual(const QVariant &value) const;
371
372     qreal scalar() const;
373     qreal x() const;
374     qreal y() const;
375     qreal z() const;
376     void setScalar(qreal);
377     void setX(qreal);
378     void setY(qreal);
379     void setZ(qreal);
380
381 private:
382     QQuaternion quaternion;
383 };
384
385 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeMatrix4x4ValueType : public QDeclarativeValueType
386 {
387     Q_PROPERTY(qreal m11 READ m11 WRITE setM11)
388     Q_PROPERTY(qreal m12 READ m12 WRITE setM12)
389     Q_PROPERTY(qreal m13 READ m13 WRITE setM13)
390     Q_PROPERTY(qreal m14 READ m14 WRITE setM14)
391     Q_PROPERTY(qreal m21 READ m21 WRITE setM21)
392     Q_PROPERTY(qreal m22 READ m22 WRITE setM22)
393     Q_PROPERTY(qreal m23 READ m23 WRITE setM23)
394     Q_PROPERTY(qreal m24 READ m24 WRITE setM24)
395     Q_PROPERTY(qreal m31 READ m31 WRITE setM31)
396     Q_PROPERTY(qreal m32 READ m32 WRITE setM32)
397     Q_PROPERTY(qreal m33 READ m33 WRITE setM33)
398     Q_PROPERTY(qreal m34 READ m34 WRITE setM34)
399     Q_PROPERTY(qreal m41 READ m41 WRITE setM41)
400     Q_PROPERTY(qreal m42 READ m42 WRITE setM42)
401     Q_PROPERTY(qreal m43 READ m43 WRITE setM43)
402     Q_PROPERTY(qreal m44 READ m44 WRITE setM44)
403     Q_OBJECT
404 public:
405     QDeclarativeMatrix4x4ValueType(QObject *parent = 0);
406
407     virtual void read(QObject *, int);
408     virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags);
409     virtual QVariant value();
410     virtual void setValue(const QVariant &value);
411     virtual QString toString() const;
412     virtual bool isEqual(const QVariant &value) const;
413
414     qreal m11() const { return matrix(0, 0); }
415     qreal m12() const { return matrix(0, 1); }
416     qreal m13() const { return matrix(0, 2); }
417     qreal m14() const { return matrix(0, 3); }
418     qreal m21() const { return matrix(1, 0); }
419     qreal m22() const { return matrix(1, 1); }
420     qreal m23() const { return matrix(1, 2); }
421     qreal m24() const { return matrix(1, 3); }
422     qreal m31() const { return matrix(2, 0); }
423     qreal m32() const { return matrix(2, 1); }
424     qreal m33() const { return matrix(2, 2); }
425     qreal m34() const { return matrix(2, 3); }
426     qreal m41() const { return matrix(3, 0); }
427     qreal m42() const { return matrix(3, 1); }
428     qreal m43() const { return matrix(3, 2); }
429     qreal m44() const { return matrix(3, 3); }
430
431     void setM11(qreal value) { matrix(0, 0) = value; }
432     void setM12(qreal value) { matrix(0, 1) = value; }
433     void setM13(qreal value) { matrix(0, 2) = value; }
434     void setM14(qreal value) { matrix(0, 3) = value; }
435     void setM21(qreal value) { matrix(1, 0) = value; }
436     void setM22(qreal value) { matrix(1, 1) = value; }
437     void setM23(qreal value) { matrix(1, 2) = value; }
438     void setM24(qreal value) { matrix(1, 3) = value; }
439     void setM31(qreal value) { matrix(2, 0) = value; }
440     void setM32(qreal value) { matrix(2, 1) = value; }
441     void setM33(qreal value) { matrix(2, 2) = value; }
442     void setM34(qreal value) { matrix(2, 3) = value; }
443     void setM41(qreal value) { matrix(3, 0) = value; }
444     void setM42(qreal value) { matrix(3, 1) = value; }
445     void setM43(qreal value) { matrix(3, 2) = value; }
446     void setM44(qreal value) { matrix(3, 3) = value; }
447
448 private:
449     QMatrix4x4 matrix;
450 };
451
452 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeEasingValueType : public QDeclarativeValueType
453 {
454     Q_OBJECT
455     Q_ENUMS(Type)
456
457     Q_PROPERTY(QDeclarativeEasingValueType::Type type READ type WRITE setType)
458     Q_PROPERTY(qreal amplitude READ amplitude WRITE setAmplitude)
459     Q_PROPERTY(qreal overshoot READ overshoot WRITE setOvershoot)
460     Q_PROPERTY(qreal period READ period WRITE setPeriod)
461     Q_PROPERTY(QVariantList bezierCurve READ bezierCurve WRITE setBezierCurve)
462 public:
463     enum Type {
464         Linear = QEasingCurve::Linear,
465         InQuad = QEasingCurve::InQuad, OutQuad = QEasingCurve::OutQuad,
466         InOutQuad = QEasingCurve::InOutQuad, OutInQuad = QEasingCurve::OutInQuad,
467         InCubic = QEasingCurve::InCubic, OutCubic = QEasingCurve::OutCubic,
468         InOutCubic = QEasingCurve::InOutCubic, OutInCubic = QEasingCurve::OutInCubic,
469         InQuart = QEasingCurve::InQuart, OutQuart = QEasingCurve::OutQuart,
470         InOutQuart = QEasingCurve::InOutQuart, OutInQuart = QEasingCurve::OutInQuart,
471         InQuint = QEasingCurve::InQuint, OutQuint = QEasingCurve::OutQuint,
472         InOutQuint = QEasingCurve::InOutQuint, OutInQuint = QEasingCurve::OutInQuint,
473         InSine = QEasingCurve::InSine, OutSine = QEasingCurve::OutSine,
474         InOutSine = QEasingCurve::InOutSine, OutInSine = QEasingCurve::OutInSine,
475         InExpo = QEasingCurve::InExpo, OutExpo = QEasingCurve::OutExpo,
476         InOutExpo = QEasingCurve::InOutExpo, OutInExpo = QEasingCurve::OutInExpo,
477         InCirc = QEasingCurve::InCirc, OutCirc = QEasingCurve::OutCirc,
478         InOutCirc = QEasingCurve::InOutCirc, OutInCirc = QEasingCurve::OutInCirc,
479         InElastic = QEasingCurve::InElastic, OutElastic = QEasingCurve::OutElastic,
480         InOutElastic = QEasingCurve::InOutElastic, OutInElastic = QEasingCurve::OutInElastic,
481         InBack = QEasingCurve::InBack, OutBack = QEasingCurve::OutBack,
482         InOutBack = QEasingCurve::InOutBack, OutInBack = QEasingCurve::OutInBack,
483         InBounce = QEasingCurve::InBounce, OutBounce = QEasingCurve::OutBounce,
484         InOutBounce = QEasingCurve::InOutBounce, OutInBounce = QEasingCurve::OutInBounce,
485         InCurve = QEasingCurve::InCurve, OutCurve = QEasingCurve::OutCurve,
486         SineCurve = QEasingCurve::SineCurve, CosineCurve = QEasingCurve::CosineCurve,
487         Bezier = QEasingCurve::BezierSpline
488     };
489
490     QDeclarativeEasingValueType(QObject *parent = 0);
491
492     virtual void read(QObject *, int);
493     virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags);
494     virtual QVariant value();
495     virtual void setValue(const QVariant &value);
496     virtual QString toString() const;
497     virtual bool isEqual(const QVariant &value) const;
498
499     Type type() const;
500     qreal amplitude() const;
501     qreal overshoot() const;
502     qreal period() const;
503     void setType(Type);
504     void setAmplitude(qreal);
505     void setOvershoot(qreal);
506     void setPeriod(qreal);
507     void setBezierCurve(const QVariantList &);
508     QVariantList bezierCurve() const;
509
510
511 private:
512     QEasingCurve easing;
513 };
514
515 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeFontValueType : public QDeclarativeValueType
516 {
517     Q_OBJECT
518     Q_ENUMS(FontWeight)
519     Q_ENUMS(Capitalization)
520
521     Q_PROPERTY(QString family READ family WRITE setFamily)
522     Q_PROPERTY(bool bold READ bold WRITE setBold)
523     Q_PROPERTY(FontWeight weight READ weight WRITE setWeight)
524     Q_PROPERTY(bool italic READ italic WRITE setItalic)
525     Q_PROPERTY(bool underline READ underline WRITE setUnderline)
526     Q_PROPERTY(bool overline READ overline WRITE setOverline)
527     Q_PROPERTY(bool strikeout READ strikeout WRITE setStrikeout)
528     Q_PROPERTY(qreal pointSize READ pointSize WRITE setPointSize)
529     Q_PROPERTY(int pixelSize READ pixelSize WRITE setPixelSize)
530     Q_PROPERTY(Capitalization capitalization READ capitalization WRITE setCapitalization)
531     Q_PROPERTY(qreal letterSpacing READ letterSpacing WRITE setLetterSpacing)
532     Q_PROPERTY(qreal wordSpacing READ wordSpacing WRITE setWordSpacing)
533
534 public:
535     enum FontWeight { Light = QFont::Light,
536                        Normal = QFont::Normal,
537                        DemiBold = QFont::DemiBold,
538                        Bold = QFont::Bold,
539                        Black = QFont::Black };
540     enum Capitalization { MixedCase = QFont::MixedCase,
541                            AllUppercase = QFont::AllUppercase,
542                            AllLowercase = QFont::AllLowercase,
543                            SmallCaps = QFont::SmallCaps,
544                            Capitalize = QFont::Capitalize };
545
546     QDeclarativeFontValueType(QObject *parent = 0);
547
548     virtual void read(QObject *, int);
549     virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags);
550     virtual QVariant value();
551     virtual void setValue(const QVariant &value);
552     virtual QString toString() const;
553     virtual bool isEqual(const QVariant &value) const;
554
555     QString family() const;
556     void setFamily(const QString &);
557
558     bool bold() const;
559     void setBold(bool b);
560
561     FontWeight weight() const;
562     void setWeight(FontWeight);
563
564     bool italic() const;
565     void setItalic(bool b);
566
567     bool underline() const;
568     void setUnderline(bool b);
569
570     bool overline() const;
571     void setOverline(bool b);
572
573     bool strikeout() const;
574     void setStrikeout(bool b);
575
576     qreal pointSize() const;
577     void setPointSize(qreal size);
578
579     int pixelSize() const;
580     void setPixelSize(int size);
581
582     Capitalization capitalization() const;
583     void setCapitalization(Capitalization);
584
585     qreal letterSpacing() const;
586     void setLetterSpacing(qreal spacing);
587
588     qreal wordSpacing() const;
589     void setWordSpacing(qreal spacing);
590
591     void onLoad();
592 private:
593     QFont font;
594     bool pixelSizeSet;
595     bool pointSizeSet;
596     mutable QDeclarativeNullableValue<int> dpi;
597 };
598
599 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeColorValueType : public QDeclarativeValueType
600 {
601     Q_PROPERTY(qreal r READ r WRITE setR)
602     Q_PROPERTY(qreal g READ g WRITE setG)
603     Q_PROPERTY(qreal b READ b WRITE setB)
604     Q_PROPERTY(qreal a READ a WRITE setA)
605     Q_OBJECT
606 public:
607     QDeclarativeColorValueType(QObject *parent = 0);
608
609     virtual void read(QObject *, int);
610     virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags);
611     virtual QVariant value();
612     virtual void setValue(const QVariant &value);
613     virtual QString toString() const;
614     virtual bool isEqual(const QVariant &value) const;
615
616     qreal r() const;
617     qreal g() const;
618     qreal b() const;
619     qreal a() const;
620     void setR(qreal);
621     void setG(qreal);
622     void setB(qreal);
623     void setA(qreal);
624
625 private:
626     QColor color;
627 };
628
629 void QDeclarativeValueType::onLoad()
630 {
631 }
632
633 QT_END_NAMESPACE
634
635 #endif  // QDECLARATIVEVALUETYPE_P_H