1 /**************************************************************************
3 ** This file is part of Qt Creator
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
7 ** Contact: Nokia Corporation (info@qt.nokia.com)
10 ** GNU Lesser General Public License Usage
12 ** This file may be used under the terms of the GNU Lesser General Public
13 ** License version 2.1 as published by the Free Software Foundation and
14 ** appearing in the file LICENSE.LGPL included in the packaging of this file.
15 ** Please review the following information to ensure the GNU Lesser General
16 ** Public License version 2.1 requirements will be met:
17 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
19 ** In addition, as a special exception, Nokia gives you certain additional
20 ** rights. These rights are described in the Nokia Qt LGPL Exception
21 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
25 ** Alternatively, this file may be used in accordance with the terms and
26 ** conditions contained in a signed written agreement between you and Nokia.
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
31 **************************************************************************/
36 #include <QtGui/QWidget>
37 #include <QtCore/QEasingCurve>
38 #include <QtCore/QHash>
44 QT_MODULE(Declarative)
47 class EasingGraph: public QWidget
51 Q_PROPERTY (QString easingShape READ easingShape WRITE setEasingShape NOTIFY easingShapeChanged)
52 Q_PROPERTY (QString easingExtremes READ easingExtremes WRITE setEasingExtremes NOTIFY easingExtremesChanged)
53 Q_PROPERTY (QString easingName READ easingName WRITE setEasingName NOTIFY easingNameChanged)
54 Q_PROPERTY (qreal overshoot READ overshoot WRITE setOvershoot NOTIFY overshootChanged)
55 Q_PROPERTY (qreal amplitude READ amplitude WRITE setAmplitude NOTIFY amplitudeChanged)
56 Q_PROPERTY (qreal period READ period WRITE setPeriod NOTIFY periodChanged)
57 Q_PROPERTY (qreal duration READ duration WRITE setDuration NOTIFY durationChanged)
58 Q_PROPERTY (QColor color READ color WRITE setColor NOTIFY colorChanged)
59 Q_PROPERTY (QColor zeroColor READ zeroColor WRITE setZeroColor NOTIFY zeroColorChanged)
62 EasingGraph(QWidget *parent=0);
65 QEasingCurve::Type easingType() const;
66 QEasingCurve easingCurve() const;
68 QString easingShape() const;
69 void setEasingShape(const QString &newShape);
70 QString easingExtremes() const;
71 void setEasingExtremes(const QString &newExtremes);
72 QString easingName() const;
73 void setEasingName(const QString &newName);
74 qreal overshoot() const;
75 void setOvershoot(qreal newOvershoot);
76 qreal amplitude() const;
77 void setAmplitude(qreal newAmplitude);
79 void setPeriod(qreal newPeriod);
80 qreal duration() const;
81 void setDuration(qreal newDuration);
84 void setColor(const QColor &newColor);
85 QColor zeroColor() const;
86 void setZeroColor(const QColor &newColor);
88 QRectF boundingRect() const;
89 //void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *);
90 void paintEvent(QPaintEvent *);
93 void easingShapeChanged();
94 void easingExtremesChanged();
95 void easingNameChanged();
96 void overshootChanged();
97 void amplitudeChanged();
98 void durationChanged();
101 void zeroColorChanged();
104 Q_DISABLE_COPY(EasingGraph)
107 QColor m_zeroColor; // the color for the "zero" and "one" lines
110 QString m_easingExtremes;
112 QEasingCurve m_curveFunction;
113 QHash <QString,QEasingCurve::Type> m_availableNames;
118 //QML_DECLARE_TYPE(EasingGraph)
122 #endif // EASINGGRAPH_H