diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2009-05-29 04:44:21 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2009-05-29 04:44:21 (GMT) |
commit | 80518af09b464c88dfd419fa6087cffc1dc914b5 (patch) | |
tree | 5b610a298548aaa26e7b3ee56d36844d3f41a53d /src/declarative | |
parent | 5b542cc9faf016c9071f41fa85ab071d05b0f26a (diff) | |
parent | 9f95bd8f6e6ccf3575216285b29f2a42dcfd328d (diff) | |
download | Qt-80518af09b464c88dfd419fa6087cffc1dc914b5.zip Qt-80518af09b464c88dfd419fa6087cffc1dc914b5.tar.gz Qt-80518af09b464c88dfd419fa6087cffc1dc914b5.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src/declarative')
-rw-r--r-- | src/declarative/debugger/qmldebugclient.cpp | 2 | ||||
-rw-r--r-- | src/declarative/fx/qfxrect.cpp | 20 | ||||
-rw-r--r-- | src/declarative/fx/qfxrect.h | 18 | ||||
-rw-r--r-- | src/declarative/test/qfxtestobjects.cpp | 24 | ||||
-rw-r--r-- | src/declarative/test/qfxtestobjects.h | 28 | ||||
-rw-r--r-- | src/declarative/util/qperformancelog.h | 2 |
6 files changed, 62 insertions, 32 deletions
diff --git a/src/declarative/debugger/qmldebugclient.cpp b/src/declarative/debugger/qmldebugclient.cpp index 85ccf0b..3dacf01 100644 --- a/src/declarative/debugger/qmldebugclient.cpp +++ b/src/declarative/debugger/qmldebugclient.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include "qmldebugclient.h" -#include <private/qtcpsocket_p.h> +#include <private/qobject_p.h> #include <QtDeclarative/qpacketprotocol.h> #include <QtCore/qdebug.h> #include <QtCore/qstringlist.h> diff --git a/src/declarative/fx/qfxrect.cpp b/src/declarative/fx/qfxrect.cpp index 564faa6..c156753 100644 --- a/src/declarative/fx/qfxrect.cpp +++ b/src/declarative/fx/qfxrect.cpp @@ -133,6 +133,12 @@ void QFxPen::setWidth(int w) Sets a \e color at a \e position in a gradient. */ +void QFxGradientStop::updateGradient() +{ + if (QFxGradient *grad = qobject_cast<QFxGradient*>(parent())) + grad->doUpdate(); +} + /*! \qmlclass Gradient QFxGradient \brief The Gradient item defines a gradient fill. @@ -171,6 +177,13 @@ const QGradient *QFxGradient::gradient() const return m_gradient; } +void QFxGradient::doUpdate() +{ + delete m_gradient; + m_gradient = 0; + emit updated(); +} + QML_DEFINE_TYPE(QFxRect,Rect) /*! @@ -308,7 +321,14 @@ QFxGradient *QFxRect::gradient() const void QFxRect::setGradient(QFxGradient *gradient) { Q_D(QFxRect); + if (d->gradient == gradient) + return; + if (d->gradient) + disconnect(d->gradient, SIGNAL(updated()), this, SLOT(doUpdate())); d->gradient = gradient; + if (d->gradient) + connect(d->gradient, SIGNAL(updated()), this, SLOT(doUpdate())); + update(); } diff --git a/src/declarative/fx/qfxrect.h b/src/declarative/fx/qfxrect.h index 2c59914..c279a1c 100644 --- a/src/declarative/fx/qfxrect.h +++ b/src/declarative/fx/qfxrect.h @@ -90,10 +90,13 @@ public: QFxGradientStop(QObject *parent=0) : QObject(parent) {} qreal position() const { return m_position; } - void setPosition(qreal position) { m_position = position; } + void setPosition(qreal position) { m_position = position; updateGradient(); } QColor color() const { return m_color; } - void setColor(const QColor &color) { m_color = color; } + void setColor(const QColor &color) { m_color = color; updateGradient(); } + +private: + void updateGradient(); private: qreal m_position; @@ -109,16 +112,23 @@ class Q_DECLARATIVE_EXPORT QFxGradient : public QObject Q_CLASSINFO("DefaultProperty", "stops") public: - QFxGradient(QObject *parent=0) : QObject(parent), m_gradient(0), m_created(false) {} + QFxGradient(QObject *parent=0) : QObject(parent), m_gradient(0) {} + ~QFxGradient() { delete m_gradient; } QList<QFxGradientStop *> *stops() { return &m_stops; } const QGradient *gradient() const; +Q_SIGNALS: + void updated(); + +private: + void doUpdate(); + private: QList<QFxGradientStop *> m_stops; mutable QGradient *m_gradient; - mutable bool m_created; + friend class QFxGradientStop; }; QML_DECLARE_TYPE(QFxGradient) diff --git a/src/declarative/test/qfxtestobjects.cpp b/src/declarative/test/qfxtestobjects.cpp index 5beefd9..12fc7fb 100644 --- a/src/declarative/test/qfxtestobjects.cpp +++ b/src/declarative/test/qfxtestobjects.cpp @@ -47,18 +47,18 @@ QT_BEGIN_NAMESPACE -QML_DECLARE_TYPE(TestObject); -QML_DEFINE_TYPE(TestObject,TestObject); -QML_DECLARE_TYPE(TestFrame); -QML_DEFINE_TYPE(TestFrame,TestFrame); -QML_DECLARE_TYPE(TestFullFrame); -QML_DEFINE_TYPE(TestFullFrame,TestFullFrame); -QML_DECLARE_TYPE(TestMouse); -QML_DEFINE_TYPE(TestMouse,TestMouse); -QML_DECLARE_TYPE(TestKey); -QML_DEFINE_TYPE(TestKey,TestKey); -QML_DECLARE_TYPE(TestLog); -QML_DEFINE_TYPE(TestLog,TestLog); +QML_DECLARE_TYPE(TestObject) +QML_DEFINE_TYPE(TestObject,TestObject) +QML_DECLARE_TYPE(TestFrame) +QML_DEFINE_TYPE(TestFrame,TestFrame) +QML_DECLARE_TYPE(TestFullFrame) +QML_DEFINE_TYPE(TestFullFrame,TestFullFrame) +QML_DECLARE_TYPE(TestMouse) +QML_DEFINE_TYPE(TestMouse,TestMouse) +QML_DECLARE_TYPE(TestKey) +QML_DEFINE_TYPE(TestKey,TestKey) +QML_DECLARE_TYPE(TestLog) +QML_DEFINE_TYPE(TestLog,TestLog) static QString padding(int pad) { diff --git a/src/declarative/test/qfxtestobjects.h b/src/declarative/test/qfxtestobjects.h index de4d94b..80fcfe7 100644 --- a/src/declarative/test/qfxtestobjects.h +++ b/src/declarative/test/qfxtestobjects.h @@ -60,7 +60,7 @@ Q_OBJECT public: TestObject(QObject * = 0); - Q_PROPERTY(int time READ time WRITE setTime NOTIFY dataChanged); + Q_PROPERTY(int time READ time WRITE setTime NOTIFY dataChanged) int time() const; void setTime(int); @@ -78,7 +78,7 @@ Q_OBJECT public: TestFrame(QObject * = 0); - Q_PROPERTY(QString hash READ hash WRITE setHash NOTIFY frameChanged); + Q_PROPERTY(QString hash READ hash WRITE setHash NOTIFY frameChanged) QString hash() const; void setHash(const QString &); @@ -96,7 +96,7 @@ Q_OBJECT public: TestFullFrame(QObject * = 0); - Q_PROPERTY(int frameId READ frameId WRITE setFrameId NOTIFY frameChanged); + Q_PROPERTY(int frameId READ frameId WRITE setFrameId NOTIFY frameChanged) int frameId() const; void setFrameId(int); @@ -114,23 +114,23 @@ Q_OBJECT public: TestMouse(QObject * = 0); - Q_PROPERTY(int type READ type WRITE setType NOTIFY mouseChanged); + Q_PROPERTY(int type READ type WRITE setType NOTIFY mouseChanged) int type() const; void setType(int); - Q_PROPERTY(int button READ button WRITE setButton NOTIFY mouseChanged); + Q_PROPERTY(int button READ button WRITE setButton NOTIFY mouseChanged) int button() const; void setButton(int); - Q_PROPERTY(int buttons READ buttons WRITE setButtons NOTIFY mouseChanged); + Q_PROPERTY(int buttons READ buttons WRITE setButtons NOTIFY mouseChanged) int buttons() const; void setButtons(int); - Q_PROPERTY(QPoint globalPos READ globalPos WRITE setGlobalPos NOTIFY mouseChanged); + Q_PROPERTY(QPoint globalPos READ globalPos WRITE setGlobalPos NOTIFY mouseChanged) QPoint globalPos() const; void setGlobalPos(const QPoint &); - Q_PROPERTY(QPoint pos READ pos WRITE setPos NOTIFY mouseChanged); + Q_PROPERTY(QPoint pos READ pos WRITE setPos NOTIFY mouseChanged) QPoint pos() const; void setPos(const QPoint &); @@ -153,19 +153,19 @@ Q_OBJECT public: TestKey(QObject * = 0); - Q_PROPERTY(int type READ type WRITE setType NOTIFY keyChanged); + Q_PROPERTY(int type READ type WRITE setType NOTIFY keyChanged) int type() const; void setType(int); - Q_PROPERTY(int modifiers READ modifiers WRITE setModifiers NOTIFY keyChanged); + Q_PROPERTY(int modifiers READ modifiers WRITE setModifiers NOTIFY keyChanged) int modifiers() const; void setModifiers(int); - Q_PROPERTY(QString text READ text WRITE setText NOTIFY keyChanged); + Q_PROPERTY(QString text READ text WRITE setText NOTIFY keyChanged) QString text() const; void setText(const QString &); - Q_PROPERTY(int key READ key WRITE setKey NOTIFY keyChanged); + Q_PROPERTY(int key READ key WRITE setKey NOTIFY keyChanged) int key() const; void setKey(int); @@ -187,8 +187,8 @@ Q_OBJECT public: TestLog(QObject * = 0); - Q_CLASSINFO("DefaultProperty", "actions"); - Q_PROPERTY(QList<TestObject *> *actions READ qmlActions); + Q_CLASSINFO("DefaultProperty", "actions") + Q_PROPERTY(QList<TestObject *> *actions READ qmlActions) QList<TestObject *> *qmlActions(); QList<TestObject *> &actions(); diff --git a/src/declarative/util/qperformancelog.h b/src/declarative/util/qperformancelog.h index 9d19bbd..6bb9037 100644 --- a/src/declarative/util/qperformancelog.h +++ b/src/declarative/util/qperformancelog.h @@ -64,7 +64,7 @@ namespace QPerformanceLog void displayData(LogData *); void clear(LogData *); #endif -}; +} #ifdef Q_ENABLE_PERFORMANCE_LOG |