diff options
author | David Boddie <david.boddie@nokia.com> | 2011-06-17 11:59:47 (GMT) |
---|---|---|
committer | David Boddie <david.boddie@nokia.com> | 2011-06-17 11:59:47 (GMT) |
commit | fa4c5540bd0fd9f8bb7238c1d947f0763b8607e1 (patch) | |
tree | 10453eeb3d8c000e38a27d6d1344886de1e79736 /src/declarative | |
parent | fc2a790e96be47b4da3e308c5e0272e4840a2618 (diff) | |
parent | c390312f8fbea14ac4df0c5185ca814054f448d8 (diff) | |
download | Qt-fa4c5540bd0fd9f8bb7238c1d947f0763b8607e1.zip Qt-fa4c5540bd0fd9f8bb7238c1d947f0763b8607e1.tar.gz Qt-fa4c5540bd0fd9f8bb7238c1d947f0763b8607e1.tar.bz2 |
Merge branch '4.8' of scm.dev.nokia.troll.no:qt/qt into 4.8
Diffstat (limited to 'src/declarative')
20 files changed, 193 insertions, 97 deletions
diff --git a/src/declarative/debugger/debugger.pri b/src/declarative/debugger/debugger.pri index 044db3c..3134c79 100644 --- a/src/declarative/debugger/debugger.pri +++ b/src/declarative/debugger/debugger.pri @@ -9,7 +9,7 @@ SOURCES += \ $$PWD/qdeclarativedebugtrace.cpp \ $$PWD/qdeclarativedebughelper.cpp \ $$PWD/qdeclarativedebugserver.cpp \ - $$PWD/qdeclarativeobserverservice.cpp \ + $$PWD/qdeclarativeinspectorservice.cpp \ $$PWD/qjsdebuggeragent.cpp \ $$PWD/qjsdebugservice.cpp @@ -24,7 +24,7 @@ HEADERS += \ $$PWD/qdeclarativedebughelper_p.h \ $$PWD/qdeclarativedebugserver_p.h \ $$PWD/qdeclarativedebugserverconnection_p.h \ - $$PWD/qdeclarativeobserverservice_p.h \ - $$PWD/qdeclarativeobserverinterface_p.h \ + $$PWD/qdeclarativeinspectorservice_p.h \ + $$PWD/qdeclarativeinspectorinterface_p.h \ $$PWD/qjsdebuggeragent_p.h \ $$PWD/qjsdebugservice_p.h diff --git a/src/declarative/debugger/qdeclarativedebug.cpp b/src/declarative/debugger/qdeclarativedebug.cpp index 32c2b47..620ee1d 100644 --- a/src/declarative/debugger/qdeclarativedebug.cpp +++ b/src/declarative/debugger/qdeclarativedebug.cpp @@ -638,14 +638,15 @@ QDeclarativeDebugExpressionQuery *QDeclarativeEngineDebug::queryExpressionResult bool QDeclarativeEngineDebug::setBindingForObject(int objectDebugId, const QString &propertyName, const QVariant &bindingExpression, - bool isLiteralValue) + bool isLiteralValue, + QString source, int line) { Q_D(QDeclarativeEngineDebug); if (d->client->status() == QDeclarativeDebugClient::Enabled && objectDebugId != -1) { QByteArray message; QDataStream ds(&message, QIODevice::WriteOnly); - ds << QByteArray("SET_BINDING") << objectDebugId << propertyName << bindingExpression << isLiteralValue; + ds << QByteArray("SET_BINDING") << objectDebugId << propertyName << bindingExpression << isLiteralValue << source << line; d->client->sendMessage(message); return true; } else { diff --git a/src/declarative/debugger/qdeclarativedebug_p.h b/src/declarative/debugger/qdeclarativedebug_p.h index ae92d6a..f822637 100644 --- a/src/declarative/debugger/qdeclarativedebug_p.h +++ b/src/declarative/debugger/qdeclarativedebug_p.h @@ -101,7 +101,8 @@ public: const QString &expr, QObject *parent = 0); bool setBindingForObject(int objectDebugId, const QString &propertyName, - const QVariant &bindingExpression, bool isLiteralValue); + const QVariant &bindingExpression, bool isLiteralValue, + QString source = QString(), int line = -1); bool resetBindingForObject(int objectDebugId, const QString &propertyName); bool setMethodBody(int objectDebugId, const QString &methodName, const QString &methodBody); diff --git a/src/declarative/debugger/qdeclarativeobserverinterface_p.h b/src/declarative/debugger/qdeclarativeinspectorinterface_p.h index efb47fa..aa29d68 100644 --- a/src/declarative/debugger/qdeclarativeobserverinterface_p.h +++ b/src/declarative/debugger/qdeclarativeinspectorinterface_p.h @@ -50,17 +50,17 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class Q_DECLARATIVE_EXPORT QDeclarativeObserverInterface +class Q_DECLARATIVE_EXPORT QDeclarativeInspectorInterface { public: - QDeclarativeObserverInterface() {} - virtual ~QDeclarativeObserverInterface() {} + QDeclarativeInspectorInterface() {} + virtual ~QDeclarativeInspectorInterface() {} virtual void activate() = 0; virtual void deactivate() = 0; }; -Q_DECLARE_INTERFACE(QDeclarativeObserverInterface, "com.trolltech.Qt.QDeclarativeObserverInterface/1.0") +Q_DECLARE_INTERFACE(QDeclarativeInspectorInterface, "com.trolltech.Qt.QDeclarativeInspectorInterface/1.0") QT_END_NAMESPACE diff --git a/src/declarative/debugger/qdeclarativeobserverservice.cpp b/src/declarative/debugger/qdeclarativeinspectorservice.cpp index 43d9281..9fec006 100644 --- a/src/declarative/debugger/qdeclarativeobserverservice.cpp +++ b/src/declarative/debugger/qdeclarativeinspectorservice.cpp @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#include "private/qdeclarativeobserverservice_p.h" -#include "private/qdeclarativeobserverinterface_p.h" +#include "private/qdeclarativeinspectorservice_p.h" +#include "private/qdeclarativeinspectorinterface_p.h" #include <QtCore/QCoreApplication> #include <QtCore/QDebug> @@ -51,30 +51,30 @@ QT_BEGIN_NAMESPACE -Q_GLOBAL_STATIC(QDeclarativeObserverService, serviceInstance) +Q_GLOBAL_STATIC(QDeclarativeInspectorService, serviceInstance) -QDeclarativeObserverService::QDeclarativeObserverService() +QDeclarativeInspectorService::QDeclarativeInspectorService() : QDeclarativeDebugService(QLatin1String("QDeclarativeObserverMode")) - , m_observer(0) + , m_inspectorPlugin(0) { } -QDeclarativeObserverService *QDeclarativeObserverService::instance() +QDeclarativeInspectorService *QDeclarativeInspectorService::instance() { return serviceInstance(); } -void QDeclarativeObserverService::addView(QDeclarativeView *view) +void QDeclarativeInspectorService::addView(QDeclarativeView *view) { m_views.append(view); } -void QDeclarativeObserverService::removeView(QDeclarativeView *view) +void QDeclarativeInspectorService::removeView(QDeclarativeView *view) { m_views.removeAll(view); } -void QDeclarativeObserverService::sendMessage(const QByteArray &message) +void QDeclarativeInspectorService::sendMessage(const QByteArray &message) { if (status() != Enabled) return; @@ -82,33 +82,33 @@ void QDeclarativeObserverService::sendMessage(const QByteArray &message) QDeclarativeDebugService::sendMessage(message); } -void QDeclarativeObserverService::statusChanged(Status status) +void QDeclarativeInspectorService::statusChanged(Status status) { if (m_views.isEmpty()) return; if (status == Enabled) { - if (!m_observer) - m_observer = loadObserverPlugin(); + if (!m_inspectorPlugin) + m_inspectorPlugin = loadInspectorPlugin(); - if (!m_observer) { - qWarning() << "Error while loading observer plugin"; + if (!m_inspectorPlugin) { + qWarning() << "Error while loading inspector plugin"; return; } - m_observer->activate(); + m_inspectorPlugin->activate(); } else { - if (m_observer) - m_observer->deactivate(); + if (m_inspectorPlugin) + m_inspectorPlugin->deactivate(); } } -void QDeclarativeObserverService::messageReceived(const QByteArray &message) +void QDeclarativeInspectorService::messageReceived(const QByteArray &message) { emit gotMessage(message); } -QDeclarativeObserverInterface *QDeclarativeObserverService::loadObserverPlugin() +QDeclarativeInspectorInterface *QDeclarativeInspectorService::loadInspectorPlugin() { QStringList pluginCandidates; const QStringList paths = QCoreApplication::libraryPaths(); @@ -124,11 +124,11 @@ QDeclarativeObserverInterface *QDeclarativeObserverService::loadObserverPlugin() if (!loader.load()) continue; - QDeclarativeObserverInterface *observer = - qobject_cast<QDeclarativeObserverInterface*>(loader.instance()); + QDeclarativeInspectorInterface *inspector = + qobject_cast<QDeclarativeInspectorInterface*>(loader.instance()); - if (observer) - return observer; + if (inspector) + return inspector; loader.unload(); } return 0; diff --git a/src/declarative/debugger/qdeclarativeobserverservice_p.h b/src/declarative/debugger/qdeclarativeinspectorservice_p.h index c883d4b..9fe0d601f 100644 --- a/src/declarative/debugger/qdeclarativeobserverservice_p.h +++ b/src/declarative/debugger/qdeclarativeinspectorservice_p.h @@ -54,15 +54,15 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) class QDeclarativeView; -class QDeclarativeObserverInterface; +class QDeclarativeInspectorInterface; -class Q_DECLARATIVE_EXPORT QDeclarativeObserverService : public QDeclarativeDebugService +class Q_DECLARATIVE_EXPORT QDeclarativeInspectorService : public QDeclarativeDebugService { Q_OBJECT public: - QDeclarativeObserverService(); - static QDeclarativeObserverService *instance(); + QDeclarativeInspectorService(); + static QDeclarativeInspectorService *instance(); void addView(QDeclarativeView *); void removeView(QDeclarativeView *); @@ -78,10 +78,10 @@ protected: virtual void messageReceived(const QByteArray &); private: - static QDeclarativeObserverInterface *loadObserverPlugin(); + static QDeclarativeInspectorInterface *loadInspectorPlugin(); QList<QDeclarativeView*> m_views; - QDeclarativeObserverInterface *m_observer; + QDeclarativeInspectorInterface *m_inspectorPlugin; }; QT_END_NAMESPACE diff --git a/src/declarative/debugger/qjsdebuggeragent.cpp b/src/declarative/debugger/qjsdebuggeragent.cpp index 9b76592..dff637b 100644 --- a/src/declarative/debugger/qjsdebuggeragent.cpp +++ b/src/declarative/debugger/qjsdebuggeragent.cpp @@ -56,7 +56,7 @@ class QJSDebuggerAgentPrivate { public: QJSDebuggerAgentPrivate(QJSDebuggerAgent *q) - : q(q), state(NoState) + : q(q), state(NoState), isInitialized(false) {} void continueExec(); @@ -79,6 +79,7 @@ public: QHash<QString, JSAgentBreakpointData> fileNameToBreakpoints; QStringList watchExpressions; QSet<qint64> knownObjectIds; + bool isInitialized; }; namespace { @@ -252,6 +253,14 @@ QJSDebuggerAgent::~QJSDebuggerAgent() delete d; } +/*! + Indicates whether the agent got the list of breakpoints. + */ +bool QJSDebuggerAgent::isInitialized() const +{ + return d->isInitialized; +} + void QJSDebuggerAgent::setBreakpoints(const JSAgentBreakpoints &breakpoints) { d->breakpoints = breakpoints; @@ -259,6 +268,8 @@ void QJSDebuggerAgent::setBreakpoints(const JSAgentBreakpoints &breakpoints) d->fileNameToBreakpoints.clear(); foreach (const JSAgentBreakpointData &bp, breakpoints) d->fileNameToBreakpoints.insertMulti(fileName(QString::fromUtf8(bp.fileUrl)), bp); + + d->isInitialized = true; } void QJSDebuggerAgent::setWatchExpressions(const QStringList &watchExpressions) diff --git a/src/declarative/debugger/qjsdebuggeragent_p.h b/src/declarative/debugger/qjsdebuggeragent_p.h index 5aa3c9c..309588e 100644 --- a/src/declarative/debugger/qjsdebuggeragent_p.h +++ b/src/declarative/debugger/qjsdebuggeragent_p.h @@ -145,6 +145,8 @@ public: QJSDebuggerAgent(QDeclarativeEngine *engine, QObject *parent = 0); ~QJSDebuggerAgent(); + bool isInitialized() const; + void setBreakpoints(const JSAgentBreakpoints &); void setWatchExpressions(const QStringList &); diff --git a/src/declarative/debugger/qjsdebugservice.cpp b/src/declarative/debugger/qjsdebugservice.cpp index 4ce2c90..ad84f65 100644 --- a/src/declarative/debugger/qjsdebugservice.cpp +++ b/src/declarative/debugger/qjsdebugservice.cpp @@ -71,6 +71,16 @@ void QJSDebugService::addEngine(QDeclarativeEngine *engine) Q_ASSERT(!m_engines.contains(engine)); m_engines.append(engine); + + if (status() == Enabled && !m_engines.isEmpty() && !m_agent) { + m_agent = new QJSDebuggerAgent(engine, engine); + connect(m_agent, SIGNAL(stopped(bool,QString)), + this, SLOT(executionStopped(bool,QString))); + + while (!m_agent->isInitialized()) { + waitForMessage(); + } + } } void QJSDebugService::removeEngine(QDeclarativeEngine *engine) diff --git a/src/declarative/debugger/qpacketprotocol.cpp b/src/declarative/debugger/qpacketprotocol.cpp index c24df61..9caaa79 100644 --- a/src/declarative/debugger/qpacketprotocol.cpp +++ b/src/declarative/debugger/qpacketprotocol.cpp @@ -164,47 +164,45 @@ public Q_SLOTS: void readyToRead() { - if(-1 == inProgressSize) { - // We need a size header of sizeof(qint32) - if(sizeof(qint32) > (uint)dev->bytesAvailable()) - return; - - // Read size header - int read = dev->read((char *)&inProgressSize, sizeof(qint32)); - Q_ASSERT(read == sizeof(qint32)); - Q_UNUSED(read); - - // Check sizing constraints - if(inProgressSize > maxPacketSize) { - QObject::disconnect(dev, SIGNAL(readyRead()), - this, SLOT(readyToRead())); - QObject::disconnect(dev, SIGNAL(aboutToClose()), - this, SLOT(aboutToClose())); - QObject::disconnect(dev, SIGNAL(bytesWritten(qint64)), - this, SLOT(bytesWritten(qint64))); - dev = 0; - emit invalidPacket(); - return; - } - - inProgressSize -= sizeof(qint32); - + while (true) { // Need to get trailing data - readyToRead(); - } else { - inProgress.append(dev->read(inProgressSize - inProgress.size())); - - if(inProgressSize == inProgress.size()) { - // Packet has arrived! - packets.append(inProgress); - inProgressSize = -1; - inProgress.clear(); - - emit readyRead(); - waitingForPacket = false; - - // Need to get trailing data - readyToRead(); + if (-1 == inProgressSize) { + // We need a size header of sizeof(qint32) + if (sizeof(qint32) > (uint)dev->bytesAvailable()) + return; + + // Read size header + int read = dev->read((char *)&inProgressSize, sizeof(qint32)); + Q_ASSERT(read == sizeof(qint32)); + Q_UNUSED(read); + + // Check sizing constraints + if (inProgressSize > maxPacketSize) { + QObject::disconnect(dev, SIGNAL(readyRead()), + this, SLOT(readyToRead())); + QObject::disconnect(dev, SIGNAL(aboutToClose()), + this, SLOT(aboutToClose())); + QObject::disconnect(dev, SIGNAL(bytesWritten(qint64)), + this, SLOT(bytesWritten(qint64))); + dev = 0; + emit invalidPacket(); + return; + } + + inProgressSize -= sizeof(qint32); + } else { + inProgress.append(dev->read(inProgressSize - inProgress.size())); + + if (inProgressSize == inProgress.size()) { + // Packet has arrived! + packets.append(inProgress); + inProgressSize = -1; + inProgress.clear(); + + waitingForPacket = false; + emit readyRead(); + } else + return; } } } diff --git a/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp b/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp index b7fcbb5..8787a5e 100644 --- a/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp @@ -87,6 +87,32 @@ QT_BEGIN_NAMESPACE */ /*! + \qmlproperty url AnimatedImage::source + + This property holds the URL that refers to the source image. + + AnimatedImage can handle any image format supported by Qt, loaded from any + URL scheme supported by Qt. + + \sa QDeclarativeImageProvider +*/ + +/*! + \qmlproperty bool AnimatedImage::asynchronous + + Specifies that images on the local filesystem should be loaded + asynchronously in a separate thread. The default value is + false, causing the user interface thread to block while the + image is loaded. Setting \a asynchronous to true is useful where + maintaining a responsive user interface is more desirable + than having images immediately visible. + + Note that this property is only valid for images read from the + local filesystem. Images loaded via a network resource (e.g. HTTP) + are always loaded asynchonously. +*/ + +/*! \qmlproperty bool AnimatedImage::cache \since Quick 1.1 diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index 45e3e29..a0264f7 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -817,7 +817,9 @@ void QDeclarativeGridViewPrivate::createHighlight() if (highlight) { if (trackedItem == highlight) trackedItem = 0; - delete highlight->item; + if (highlight->item->scene()) + highlight->item->scene()->removeItem(highlight->item); + highlight->item->deleteLater(); delete highlight; highlight = 0; delete highlightXAnimator; diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index c3a75e6..7a5e433 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -942,7 +942,9 @@ void QDeclarativeListViewPrivate::createHighlight() if (highlight) { if (trackedItem == highlight) trackedItem = 0; - delete highlight->item; + if (highlight->item->scene()) + highlight->item->scene()->removeItem(highlight->item); + highlight->item->deleteLater(); delete highlight; highlight = 0; delete highlightPosAnimator; diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp index 79e52cd..94f128d 100644 --- a/src/declarative/graphicsitems/qdeclarativepathview.cpp +++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp @@ -203,7 +203,9 @@ void QDeclarativePathViewPrivate::createHighlight() bool changed = false; if (highlightItem) { - delete highlightItem; + if (highlightItem->scene()) + highlightItem->scene()->removeItem(highlightItem); + highlightItem->deleteLater(); highlightItem = 0; changed = true; } diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index e5e89d4..8679445 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -771,9 +771,6 @@ QNetworkAccessManager *QDeclarativeEngine::networkAccessManager() const All required image providers should be added to the engine before any QML sources files are loaded. - Note that images loaded from a QDeclarativeImageProvider are cached - by QPixmapCache, similar to any image loaded by QML. - \sa removeImageProvider() */ void QDeclarativeEngine::addImageProvider(const QString &providerId, QDeclarativeImageProvider *provider) diff --git a/src/declarative/qml/qdeclarativeimageprovider.cpp b/src/declarative/qml/qdeclarativeimageprovider.cpp index 559adf4..fa88c00 100644 --- a/src/declarative/qml/qdeclarativeimageprovider.cpp +++ b/src/declarative/qml/qdeclarativeimageprovider.cpp @@ -136,7 +136,8 @@ public: Image providers that support QImage loading automatically include support for asychronous loading of images. To enable asynchronous loading for an - \l Image source, set \l Image::asynchronous to \c true. When this is enabled, + image source, set the \c asynchronous property to \c true for the relevant + \l Image, \l BorderImage or \l AnimatedImage object. When this is enabled, the image request to the provider is run in a low priority thread, allowing image loading to be executed in the background, and reducing the performance impact on the user interface. @@ -147,6 +148,17 @@ public: \c true, the value is ignored and the image is loaded synchronously. + + \section2 Image caching + + Images returned by a QDeclarativeImageProvider are automatically cached, + similar to any image loaded by the QML engine. When an image with a + "image://" prefix is loaded from cache, requestImage() and requestPixmap() + will not be called for the relevant image provider. If an image should always + be fetched from the image provider, and should not be cached at all, set the + \c cache property to \c false for the relevant \l Image, \l BorderImage or + \l AnimatedImage object. + \sa QDeclarativeEngine::addImageProvider() */ diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp index efaa7f0..ce21bcd 100644 --- a/src/declarative/util/qdeclarativeanimation.cpp +++ b/src/declarative/util/qdeclarativeanimation.cpp @@ -1522,6 +1522,7 @@ void QDeclarativeAnimationGroupPrivate::append_animation(QDeclarativeListPropert QDeclarativeAnimationGroup *q = qobject_cast<QDeclarativeAnimationGroup *>(list->object); if (q) { a->setGroup(q); + // This is an optimization for the parenting that already occurs via addAnimation QDeclarative_setParent_noEvent(a->qtAnimation(), q->d_func()->ag); q->d_func()->ag->addAnimation(a->qtAnimation()); } @@ -1531,9 +1532,12 @@ void QDeclarativeAnimationGroupPrivate::clear_animation(QDeclarativeListProperty { QDeclarativeAnimationGroup *q = qobject_cast<QDeclarativeAnimationGroup *>(list->object); if (q) { - for (int i = 0; i < q->d_func()->animations.count(); ++i) - q->d_func()->animations.at(i)->setGroup(0); - q->d_func()->animations.clear(); + while (q->d_func()->animations.count()) { + QDeclarativeAbstractAnimation *firstAnim = q->d_func()->animations.at(0); + QDeclarative_setParent_noEvent(firstAnim->qtAnimation(), 0); + q->d_func()->ag->removeAnimation(firstAnim->qtAnimation()); + firstAnim->setGroup(0); + } } } diff --git a/src/declarative/util/qdeclarativetransition.cpp b/src/declarative/util/qdeclarativetransition.cpp index 273060b..b63407c 100644 --- a/src/declarative/util/qdeclarativetransition.cpp +++ b/src/declarative/util/qdeclarativetransition.cpp @@ -130,6 +130,9 @@ public: endState->complete(); } static void append_animation(QDeclarativeListProperty<QDeclarativeAbstractAnimation> *list, QDeclarativeAbstractAnimation *a); + static int animation_count(QDeclarativeListProperty<QDeclarativeAbstractAnimation> *list); + static QDeclarativeAbstractAnimation* animation_at(QDeclarativeListProperty<QDeclarativeAbstractAnimation> *list, int pos); + static void clear_animations(QDeclarativeListProperty<QDeclarativeAbstractAnimation> *list); QList<QDeclarativeAbstractAnimation *> animations; }; @@ -141,6 +144,28 @@ void QDeclarativeTransitionPrivate::append_animation(QDeclarativeListProperty<QD a->setDisableUserControl(); } +int QDeclarativeTransitionPrivate::animation_count(QDeclarativeListProperty<QDeclarativeAbstractAnimation> *list) +{ + QDeclarativeTransition *q = static_cast<QDeclarativeTransition *>(list->object); + return q->d_func()->animations.count(); +} + +QDeclarativeAbstractAnimation* QDeclarativeTransitionPrivate::animation_at(QDeclarativeListProperty<QDeclarativeAbstractAnimation> *list, int pos) +{ + QDeclarativeTransition *q = static_cast<QDeclarativeTransition *>(list->object); + return q->d_func()->animations.at(pos); +} + +void QDeclarativeTransitionPrivate::clear_animations(QDeclarativeListProperty<QDeclarativeAbstractAnimation> *list) +{ + QDeclarativeTransition *q = static_cast<QDeclarativeTransition *>(list->object); + while (q->d_func()->animations.count()) { + QDeclarativeAbstractAnimation *firstAnim = q->d_func()->animations.at(0); + q->d_func()->group.removeAnimation(firstAnim->qtAnimation()); + q->d_func()->animations.removeAll(firstAnim); + } +} + void ParallelAnimationWrapper::updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState) { QParallelAnimationGroup::updateState(newState, oldState); @@ -309,7 +334,10 @@ void QDeclarativeTransition::setToState(const QString &t) QDeclarativeListProperty<QDeclarativeAbstractAnimation> QDeclarativeTransition::animations() { Q_D(QDeclarativeTransition); - return QDeclarativeListProperty<QDeclarativeAbstractAnimation>(this, &d->animations, QDeclarativeTransitionPrivate::append_animation); + return QDeclarativeListProperty<QDeclarativeAbstractAnimation>(this, &d->animations, QDeclarativeTransitionPrivate::append_animation, + QDeclarativeTransitionPrivate::animation_count, + QDeclarativeTransitionPrivate::animation_at, + QDeclarativeTransitionPrivate::clear_animations); } QT_END_NAMESPACE diff --git a/src/declarative/util/qdeclarativetransitionmanager.cpp b/src/declarative/util/qdeclarativetransitionmanager.cpp index 944b37f..6e96ac9 100644 --- a/src/declarative/util/qdeclarativetransitionmanager.cpp +++ b/src/declarative/util/qdeclarativetransitionmanager.cpp @@ -56,12 +56,12 @@ class QDeclarativeTransitionManagerPrivate { public: QDeclarativeTransitionManagerPrivate() - : state(0), transition(0) {} + : state(0) {} void applyBindings(); typedef QList<QDeclarativeSimpleAction> SimpleActionList; QDeclarativeState *state; - QDeclarativeTransition *transition; + QDeclarativeGuard<QDeclarativeTransition> transition; QDeclarativeStateOperation::ActionList bindingsList; SimpleActionList completeList; }; @@ -253,7 +253,7 @@ void QDeclarativeTransitionManager::cancel() { if (d->transition) { // ### this could potentially trigger a complete in rare circumstances - d->transition->stop(); + d->transition->stop(); d->transition = 0; } diff --git a/src/declarative/util/qdeclarativeview.cpp b/src/declarative/util/qdeclarativeview.cpp index f6be2d7..bab991b 100644 --- a/src/declarative/util/qdeclarativeview.cpp +++ b/src/declarative/util/qdeclarativeview.cpp @@ -49,7 +49,7 @@ #include <qdeclarativeguard_p.h> #include <private/qdeclarativedebugtrace_p.h> -#include <private/qdeclarativeobserverservice_p.h> +#include <private/qdeclarativeinspectorservice_p.h> #include <qscriptvalueiterator.h> #include <qdebug.h> @@ -301,7 +301,7 @@ void QDeclarativeViewPrivate::init() q->viewport()->setAttribute(Qt::WA_NoSystemBackground); #endif - QDeclarativeObserverService::instance()->addView(q); + QDeclarativeInspectorService::instance()->addView(q); } /*! @@ -309,7 +309,7 @@ void QDeclarativeViewPrivate::init() */ QDeclarativeView::~QDeclarativeView() { - QDeclarativeObserverService::instance()->removeView(this); + QDeclarativeInspectorService::instance()->removeView(this); } /*! \property QDeclarativeView::source |