diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2010-03-09 01:33:14 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2010-03-09 01:33:14 (GMT) |
commit | a0cc850f0468af7d4d3c99e9c2bc418f064ea7f8 (patch) | |
tree | afad1c58972bf12f15250cb4fc426d72ba9e5af8 /src/declarative/util | |
parent | 0b4d84e3980e415df3078e97d44ee5216fbbff07 (diff) | |
parent | 5fac3f48019263e8544edffb2dd053238d8670bf (diff) | |
download | Qt-a0cc850f0468af7d4d3c99e9c2bc418f064ea7f8.zip Qt-a0cc850f0468af7d4d3c99e9c2bc418f064ea7f8.tar.gz Qt-a0cc850f0468af7d4d3c99e9c2bc418f064ea7f8.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
Diffstat (limited to 'src/declarative/util')
-rw-r--r-- | src/declarative/util/qdeclarativebehavior.cpp | 1 | ||||
-rw-r--r-- | src/declarative/util/qdeclarativebehavior_p.h | 1 | ||||
-rw-r--r-- | src/declarative/util/qdeclarativetimeline_p_p.h | 2 | ||||
-rw-r--r-- | src/declarative/util/qdeclarativeview.h | 4 | ||||
-rw-r--r-- | src/declarative/util/qdeclarativexmllistmodel.cpp | 34 |
5 files changed, 25 insertions, 17 deletions
diff --git a/src/declarative/util/qdeclarativebehavior.cpp b/src/declarative/util/qdeclarativebehavior.cpp index dea2c02..d90ca33 100644 --- a/src/declarative/util/qdeclarativebehavior.cpp +++ b/src/declarative/util/qdeclarativebehavior.cpp @@ -157,6 +157,7 @@ void QDeclarativeBehavior::setEnabled(bool enabled) void QDeclarativeBehavior::write(const QVariant &value) { Q_D(QDeclarativeBehavior); + qmlExecuteDeferred(this); if (!d->animation || !d->enabled) { QDeclarativePropertyPrivate::write(d->property, value, QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding); return; diff --git a/src/declarative/util/qdeclarativebehavior_p.h b/src/declarative/util/qdeclarativebehavior_p.h index a633b55..ff58210 100644 --- a/src/declarative/util/qdeclarativebehavior_p.h +++ b/src/declarative/util/qdeclarativebehavior_p.h @@ -65,6 +65,7 @@ class Q_DECLARATIVE_EXPORT QDeclarativeBehavior : public QObject, public QDeclar Q_CLASSINFO("DefaultProperty", "animation") Q_PROPERTY(QDeclarativeAbstractAnimation *animation READ animation WRITE setAnimation) Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged) + Q_CLASSINFO("DeferredPropertyNames", "animation") public: QDeclarativeBehavior(QObject *parent=0); diff --git a/src/declarative/util/qdeclarativetimeline_p_p.h b/src/declarative/util/qdeclarativetimeline_p_p.h index c08c07c..598c897 100644 --- a/src/declarative/util/qdeclarativetimeline_p_p.h +++ b/src/declarative/util/qdeclarativetimeline_p_p.h @@ -160,7 +160,7 @@ public: QDeclarativeTimeLineObject *callbackObject() const; private: - friend class QDeclarativeTimeLinePrivate; + friend struct QDeclarativeTimeLinePrivate; Callback d0; void *d1; QDeclarativeTimeLineObject *d2; diff --git a/src/declarative/util/qdeclarativeview.h b/src/declarative/util/qdeclarativeview.h index 03d8db3..107f3f9 100644 --- a/src/declarative/util/qdeclarativeview.h +++ b/src/declarative/util/qdeclarativeview.h @@ -43,6 +43,7 @@ #define QDECLARATIVEVIEW_H #include <QtCore/qdatetime.h> +#include <QtCore/qurl.h> #include <QtGui/qgraphicssceneevent.h> #include <QtGui/qgraphicsview.h> #include <QtGui/qwidget.h> @@ -64,7 +65,8 @@ class Q_DECLARATIVE_EXPORT QDeclarativeView : public QGraphicsView Q_OBJECT Q_PROPERTY(ResizeMode resizeMode READ resizeMode WRITE setResizeMode) Q_PROPERTY(Status status READ status NOTIFY statusChanged) - + Q_PROPERTY(QUrl source READ source WRITE setSource DESIGNABLE true) + Q_ENUMS(ResizeMode Status) public: explicit QDeclarativeView(QWidget *parent = 0); QDeclarativeView(const QUrl &source, QWidget *parent = 0); diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp index 53e08b0..49dbb27 100644 --- a/src/declarative/util/qdeclarativexmllistmodel.cpp +++ b/src/declarative/util/qdeclarativexmllistmodel.cpp @@ -61,9 +61,6 @@ QT_BEGIN_NAMESPACE - - - typedef QPair<int, int> QDeclarativeXmlListRange; /*! @@ -114,9 +111,6 @@ class QDeclarativeXmlQuery : public QThread { Q_OBJECT public: - QDeclarativeXmlQuery(QObject *parent=0) - : QThread(parent), m_quit(false), m_restart(false), m_abort(false), m_queryId(0) { - } ~QDeclarativeXmlQuery() { m_mutex.lock(); m_quit = true; @@ -126,6 +120,11 @@ public: wait(); } + static QDeclarativeXmlQuery *instance() { + static QDeclarativeXmlQuery *query = new QDeclarativeXmlQuery; + return query; + } + void abort() { QMutexLocker locker(&m_mutex); m_abort = true; @@ -164,6 +163,11 @@ public: return m_removedItemRanges; } +private: + QDeclarativeXmlQuery(QObject *parent=0) + : QThread(parent), m_quit(false), m_restart(false), m_abort(false), m_queryId(0) { + } + Q_SIGNALS: void queryCompleted(int queryId, int size); @@ -213,6 +217,8 @@ private: QList<QDeclarativeXmlListRange> m_removedItemRanges; }; +//Q_GLOBAL_STATIC(QDeclarativeXmlQuery, QDeclarativeXmlQuery::instance()); + void QDeclarativeXmlQuery::doQueryJob() { QString r; @@ -404,7 +410,6 @@ public: QNetworkReply *reply; QDeclarativeXmlListModel::Status status; qreal progress; - QDeclarativeXmlQuery qmlXmlQuery; int queryId; QList<QDeclarativeXmlListModelRole *> roleObjects; static void append_role(QDeclarativeListProperty<QDeclarativeXmlListModelRole> *list, QDeclarativeXmlListModelRole *role); @@ -488,8 +493,7 @@ void QDeclarativeXmlListModelPrivate::clear_role(QDeclarativeListProperty<QDecla QDeclarativeXmlListModel::QDeclarativeXmlListModel(QObject *parent) : QListModelInterface(*(new QDeclarativeXmlListModelPrivate), parent) { - Q_D(QDeclarativeXmlListModel); - connect(&d->qmlXmlQuery, SIGNAL(queryCompleted(int,int)), + connect(QDeclarativeXmlQuery::instance(), SIGNAL(queryCompleted(int,int)), this, SLOT(queryCompleted(int,int))); } @@ -722,7 +726,7 @@ void QDeclarativeXmlListModel::reload() if (!d->isComponentComplete) return; - d->qmlXmlQuery.abort(); + QDeclarativeXmlQuery::instance()->abort(); d->queryId = -1; int count = d->size; @@ -754,7 +758,7 @@ void QDeclarativeXmlListModel::reload() } if (!d->xml.isEmpty()) { - d->queryId = d->qmlXmlQuery.doQuery(d->query, d->namespaces, d->xml.toUtf8(), &d->roleObjects); + d->queryId = QDeclarativeXmlQuery::instance()->doQuery(d->query, d->namespaces, d->xml.toUtf8(), &d->roleObjects); d->progress = 1.0; d->status = Ready; emit progressChanged(d->progress); @@ -785,7 +789,7 @@ void QDeclarativeXmlListModel::requestFinished() } else { d->status = Ready; QByteArray data = d->reply->readAll(); - d->queryId = d->qmlXmlQuery.doQuery(d->query, d->namespaces, data, &d->roleObjects); + d->queryId = QDeclarativeXmlQuery::instance()->doQuery(d->query, d->namespaces, data, &d->roleObjects); disconnect(d->reply, 0, this, 0); d->reply->deleteLater(); d->reply = 0; @@ -811,10 +815,10 @@ void QDeclarativeXmlListModel::queryCompleted(int id, int size) return; bool sizeChanged = size != d->size; d->size = size; - d->data = d->qmlXmlQuery.modelData(); + d->data = QDeclarativeXmlQuery::instance()->modelData(); - QList<QDeclarativeXmlListRange> removed = d->qmlXmlQuery.removedItemRanges(); - QList<QDeclarativeXmlListRange> inserted = d->qmlXmlQuery.insertedItemRanges(); + QList<QDeclarativeXmlListRange> removed = QDeclarativeXmlQuery::instance()->removedItemRanges(); + QList<QDeclarativeXmlListRange> inserted = QDeclarativeXmlQuery::instance()->insertedItemRanges(); for (int i=0; i<removed.count(); i++) emit itemsRemoved(removed[i].first, removed[i].second); |