diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2010-03-09 00:38:03 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2010-03-09 00:38:03 (GMT) |
commit | c04a6e34b3d4da24d3cc26e192bebff2d3b79d19 (patch) | |
tree | e2a5299daa1e53668e7f9adeac002f8fdd286f8a /src/declarative | |
parent | 51900441b77df5cb4755aaf2cba8351bbfe15e71 (diff) | |
parent | db0c932bf816b76547798ec62336e25b453d29b8 (diff) | |
download | Qt-c04a6e34b3d4da24d3cc26e192bebff2d3b79d19.zip Qt-c04a6e34b3d4da24d3cc26e192bebff2d3b79d19.tar.gz Qt-c04a6e34b3d4da24d3cc26e192bebff2d3b79d19.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
Diffstat (limited to 'src/declarative')
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativeitem.cpp | 6 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp | 2 | ||||
-rw-r--r-- | src/declarative/util/qdeclarativexmllistmodel.cpp | 34 |
3 files changed, 24 insertions, 18 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index ff3a790..9d6b2a0 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -2217,7 +2217,7 @@ void QDeclarativeItem::setKeepMouseGrab(bool keep) \qmlmethod object Item::mapFromItem(Item item, int x, int y) Maps the point (\a x, \a y), which is in \a item's coordinate system, to - this item's coordinate system, and returns an object with \c x and \c y + this item's coordinate system, and returns an object with \c x and \c y properties matching the mapped cooordinate. If \a item is a \c null value, this maps the point from the coordinate @@ -2576,9 +2576,9 @@ bool QDeclarativeItem::sceneEvent(QEvent *event) !(k->modifiers() & (Qt::ControlModifier | Qt::AltModifier))) { keyPressEvent(static_cast<QKeyEvent *>(event)); if (!event->isAccepted()) - QGraphicsItem::sceneEvent(event); + return QGraphicsItem::sceneEvent(event); } else { - QGraphicsItem::sceneEvent(event); + return QGraphicsItem::sceneEvent(event); } } else { bool rv = QGraphicsItem::sceneEvent(event); diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp index 55f1c89..6bad4da 100644 --- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp +++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp @@ -927,6 +927,8 @@ QDeclarativeVisualDataModel::ReleaseFlags QDeclarativeVisualDataModel::release(Q if (inPackage) { emit destroyingPackage(qobject_cast<QDeclarativePackage*>(obj)); } else { + if (item->hasFocus()) + item->clearFocus(); item->setOpacity(0.0); static_cast<QGraphicsItem*>(item)->setParentItem(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); |