1 // Commit: ac5c099cc3c5b8c7eec7a49fdeb8a21037230350
2 /****************************************************************************
4 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
5 ** Contact: http://www.qt-project.org/
7 ** This file is part of the QtDeclarative module of the Qt Toolkit.
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.
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.
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.
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.
41 ****************************************************************************/
43 #ifndef QQUICKRECTANGLE_P_H
44 #define QQUICKRECTANGLE_P_H
46 #include "qquickitem.h"
48 #include <QtGui/qbrush.h>
50 #include <private/qtquickglobal_p.h>
56 class Q_QUICK_PRIVATE_EXPORT QQuickPen : public QObject
60 Q_PROPERTY(qreal width READ width WRITE setWidth NOTIFY penChanged)
61 Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY penChanged)
62 Q_PROPERTY(bool aligned READ aligned WRITE setAligned NOTIFY penChanged)
64 QQuickPen(QObject *parent=0);
67 void setWidth(qreal w);
70 void setColor(const QColor &c);
73 void setAligned(bool aligned);
87 class Q_AUTOTEST_EXPORT QQuickGradientStop : public QObject
91 Q_PROPERTY(qreal position READ position WRITE setPosition)
92 Q_PROPERTY(QColor color READ color WRITE setColor)
95 QQuickGradientStop(QObject *parent=0);
97 qreal position() const;
98 void setPosition(qreal position);
100 QColor color() const;
101 void setColor(const QColor &color);
104 void updateGradient();
111 class Q_AUTOTEST_EXPORT QQuickGradient : public QObject
115 Q_PROPERTY(QDeclarativeListProperty<QQuickGradientStop> stops READ stops)
116 Q_CLASSINFO("DefaultProperty", "stops")
119 QQuickGradient(QObject *parent=0);
122 QDeclarativeListProperty<QQuickGradientStop> stops();
124 const QGradient *gradient() const;
133 QList<QQuickGradientStop *> m_stops;
134 mutable QGradient *m_gradient;
135 friend class QQuickRectangle;
136 friend class QQuickGradientStop;
139 class QQuickRectanglePrivate;
140 class Q_QUICK_PRIVATE_EXPORT QQuickRectangle : public QQuickItem
144 Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
145 Q_PROPERTY(QQuickGradient *gradient READ gradient WRITE setGradient)
146 Q_PROPERTY(QQuickPen * border READ border CONSTANT)
147 Q_PROPERTY(qreal radius READ radius WRITE setRadius NOTIFY radiusChanged)
149 QQuickRectangle(QQuickItem *parent=0);
151 QColor color() const;
152 void setColor(const QColor &);
156 QQuickGradient *gradient() const;
157 void setGradient(QQuickGradient *gradient);
159 qreal radius() const;
160 void setRadius(qreal radius);
162 virtual QRectF boundingRect() const;
166 void radiusChanged();
169 virtual QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *);
175 Q_DISABLE_COPY(QQuickRectangle)
176 Q_DECLARE_PRIVATE(QQuickRectangle)
181 QML_DECLARE_TYPE(QQuickPen)
182 QML_DECLARE_TYPE(QQuickGradientStop)
183 QML_DECLARE_TYPE(QQuickGradient)
184 QML_DECLARE_TYPE(QQuickRectangle)
188 #endif // QQUICKRECTANGLE_P_H