diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-05-06 00:16:03 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-05-06 00:16:03 (GMT) |
commit | b291ab1f5ebb496d7eb7aae04c3f06d57a4f547d (patch) | |
tree | 5d8f46dc8f939c6176354ae5b6dc5b803db530d2 /src | |
parent | 279d9869f06d9adfeb8e84ece834b12c16ba1fb8 (diff) | |
parent | f98a10ed41f181252d83e9cebaa3772d556f6266 (diff) | |
download | Qt-b291ab1f5ebb496d7eb7aae04c3f06d57a4f547d.zip Qt-b291ab1f5ebb496d7eb7aae04c3f06d57a4f547d.tar.gz Qt-b291ab1f5ebb496d7eb7aae04c3f06d57a4f547d.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src')
-rw-r--r-- | src/declarative/fx/qfximage.cpp | 4 | ||||
-rw-r--r-- | src/declarative/fx/qfxitem.cpp | 47 | ||||
-rw-r--r-- | src/declarative/fx/qfxparticles.cpp | 8 | ||||
-rw-r--r-- | src/declarative/qml/parser/javascript.g | 5 | ||||
-rw-r--r-- | src/declarative/qml/parser/javascriptparser.cpp | 5 | ||||
-rw-r--r-- | src/declarative/qml/qmlcomponent.cpp | 29 | ||||
-rw-r--r-- | src/declarative/qml/qmlcontext.cpp | 31 | ||||
-rw-r--r-- | src/declarative/qml/qmlcontext.h | 2 | ||||
-rw-r--r-- | src/declarative/qml/qmlcontext_p.h | 3 | ||||
-rw-r--r-- | src/declarative/qml/qmlcustomparser.cpp | 44 | ||||
-rw-r--r-- | src/declarative/qml/qmldom.h | 1 | ||||
-rw-r--r-- | src/declarative/qml/qmlengine.cpp | 15 | ||||
-rw-r--r-- | src/declarative/qml/qmlmetaproperty.cpp | 40 | ||||
-rw-r--r-- | src/declarative/qml/qmlpropertyvaluesource.cpp | 7 | ||||
-rw-r--r-- | src/declarative/util/qfxview.cpp | 8 | ||||
-rw-r--r-- | src/declarative/util/qmlanimation.cpp | 36 | ||||
-rw-r--r-- | src/declarative/util/qmlanimation_p.h | 17 |
17 files changed, 220 insertions, 82 deletions
diff --git a/src/declarative/fx/qfximage.cpp b/src/declarative/fx/qfximage.cpp index 838da30..106d551 100644 --- a/src/declarative/fx/qfximage.cpp +++ b/src/declarative/fx/qfximage.cpp @@ -135,7 +135,7 @@ QFxImage::~QFxImage() This property contains the image currently being displayed by this item, which may be an empty pixmap if nothing is currently displayed. If this - property is set, the src property will be unset. This property is intended + property is set, the source property will be unset. This property is intended to be used only in C++, not in QML. */ QPixmap QFxImage::pixmap() const @@ -790,7 +790,7 @@ QFxImage::Status QFxImage::status() const } /*! - \qmlproperty string Image::src + \qmlproperty string Image::source Image can handle any image format supported by Qt, loaded from any URL scheme supported by Qt. diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp index c46c34c..b737615 100644 --- a/src/declarative/fx/qfxitem.cpp +++ b/src/declarative/fx/qfxitem.cpp @@ -476,6 +476,10 @@ void QFxItem::setItemParent(QFxItem *parent) \property QFxItem::moveToParent Playing around with view2view transitions. */ + +/*! + \internal + */ void QFxItem::moveToParent(QFxItem *parent) { if (parent && itemParent()) { @@ -793,6 +797,9 @@ QFxContents *QFxItem::contents() \property QFxItem::qmlItem */ +/*! \fn QFxItem *QFxItem::qmlItem() const + \internal + */ QFxItem *QFxItem::qmlItem() const { Q_D(const QFxItem); @@ -808,6 +815,13 @@ QFxItem *QFxItem::qmlItem() const dynamically set; otherwise an empty string is returned. */ +/*! \fn void QFxItem::qmlChanged() + This signal is emitted whenever the item's dynamic QML + string changes. + + \sa setQml() + */ + /*! \property QFxItem::qml This property holds the dynamic QML for the item. @@ -859,7 +873,14 @@ void QFxItem::setQml(const QString &qml) } } +/*! \fn void QFxItem::newChildCreated(const QString &url, QScriptValue v) + This signal is emitted with the \a url and the script value \a v, + when a new child is created. + */ +/*! + \internal + */ void QFxItem::qmlLoaded() { Q_D(QFxItem); @@ -1032,6 +1053,11 @@ void QFxItem::qmlLoaded() \endtable */ +/*! + This function is called to handle this item's changes in + geometry from \a oldGeometry to \a newGeometry. If the two + geometries are the same, it doesn't do anything. + */ void QFxItem::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) { @@ -1163,6 +1189,13 @@ void QFxItem::setFlipHorizontally(bool v) setFlip((QSimpleCanvasItem::Flip)(flip() & ~HorizontalFlip)); } +/*! \fn void QFxItem::keyPress(QFxKeyEvent *event) + This signal is emitted by keyPressEvent() for the \a event. + */ + +/*! \fn void QFxItem::keyRelease(QFxKeyEvent *event) + This signal is emitted by keyReleaseEvent() for the \a event. + */ /*! \reimp @@ -1482,6 +1515,12 @@ void QFxItem::setBaselineOffset(int offset) \endtable */ +/*! \fn void QFxItem::rotationChanged() + This signal is emitted when the rotation property is changed. + + \sa setRotation() + */ + /*! \property QFxItem::rotation This property holds the rotation of the item in degrees. @@ -1654,12 +1693,20 @@ void QFxItem::setOpacity(qreal v) emit opacityChanged(); } +/*! + Returns a value indicating whether the mouse should + remain with this item. + */ bool QFxItem::keepMouseGrab() const { Q_D(const QFxItem); return d->_keepMouse; } +/*! + The flag indicating whether the mouse should remain + with this item is set to \a keep. + */ void QFxItem::setKeepMouseGrab(bool keep) { Q_D(QFxItem); diff --git a/src/declarative/fx/qfxparticles.cpp b/src/declarative/fx/qfxparticles.cpp index b1f4f56..8535a73 100644 --- a/src/declarative/fx/qfxparticles.cpp +++ b/src/declarative/fx/qfxparticles.cpp @@ -113,8 +113,6 @@ QML_DEFINE_TYPE(QFxParticleMotion,ParticleMotion); \brief The QFxParticleMotion class is the base class for particle motion. This class causes the particles to remain static. - - \sa QFxParticles */ /*! @@ -165,8 +163,6 @@ void QFxParticleMotion::destroy(QFxParticle &particle) \class QFxParticleMotionLinear \ingroup group_effects \brief The QFxParticleMotionLinear class moves the particles linearly. - - \sa QFxParticles */ QML_DEFINE_TYPE(QFxParticleMotionLinear,ParticleMotionLinear); @@ -189,8 +185,6 @@ void QFxParticleMotionLinear::advance(QFxParticle &p, int interval) \class QFxParticleMotionGravity \ingroup group_effects \brief The QFxParticleMotionGravity class moves the particles towards a point. - - \sa QFxParticles */ QML_DEFINE_TYPE(QFxParticleMotionGravity,ParticleMotionGravity); @@ -281,8 +275,6 @@ Rect { The particles will continue roughly in the original direction, however will randomly drift to each side. - - \sa QFxParticles */ /*! diff --git a/src/declarative/qml/parser/javascript.g b/src/declarative/qml/parser/javascript.g index 5482392..ec81a7a 100644 --- a/src/declarative/qml/parser/javascript.g +++ b/src/declarative/qml/parser/javascript.g @@ -2690,12 +2690,15 @@ PropertyNameAndValueListOpt: PropertyNameAndValueList ; tk.dval = yylval; tk.loc = yylloc; + yylloc = yyprevlloc; + yylloc.offset += yylloc.length; + yylloc.startColumn += yylloc.length; yylloc.length = 0; const QString msg = QString::fromUtf8("Missing `;'"); diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Warning, - yyprevlloc.startLine, yyprevlloc.startColumn, msg)); + yylloc.startLine, yylloc.startColumn, msg)); first_token = &token_buffer[0]; last_token = &token_buffer[1]; diff --git a/src/declarative/qml/parser/javascriptparser.cpp b/src/declarative/qml/parser/javascriptparser.cpp index 185a824..897f0ce 100644 --- a/src/declarative/qml/parser/javascriptparser.cpp +++ b/src/declarative/qml/parser/javascriptparser.cpp @@ -1547,12 +1547,15 @@ case 312: { tk.dval = yylval; tk.loc = yylloc; + yylloc = yyprevlloc; + yylloc.offset += yylloc.length; + yylloc.startColumn += yylloc.length; yylloc.length = 0; const QString msg = QString::fromUtf8("Missing `;'"); diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Warning, - yyprevlloc.startLine, yyprevlloc.startColumn, msg)); + yylloc.startLine, yylloc.startColumn, msg)); first_token = &token_buffer[0]; last_token = &token_buffer[1]; diff --git a/src/declarative/qml/qmlcomponent.cpp b/src/declarative/qml/qmlcomponent.cpp index 72d4e08..f0d23ee 100644 --- a/src/declarative/qml/qmlcomponent.cpp +++ b/src/declarative/qml/qmlcomponent.cpp @@ -173,6 +173,9 @@ QmlComponent::~QmlComponent() d->cc->release(); } +/*! + Returns the component's current \l{QmlComponent::Status} {status}. + */ QmlComponent::Status QmlComponent::status() const { Q_D(const QmlComponent); @@ -235,7 +238,8 @@ bool QmlComponent::isLoading() const */ /*! - Create a QmlComponent with no data. Set setData(). + Create a QmlComponent with no data and give it the specified + \a engine and \a parent. Set the data with setData(). */ QmlComponent::QmlComponent(QmlEngine *engine, QObject *parent) : QObject(*(new QmlComponentPrivate), parent) @@ -245,7 +249,10 @@ QmlComponent::QmlComponent(QmlEngine *engine, QObject *parent) } /*! - Create a QmlComponent from the given \a url. + Create a QmlComponent from the given \a url and give it the + specified \a parent and \a engine. + + \sa loadUrl() */ QmlComponent::QmlComponent(QmlEngine *engine, const QUrl &url, QObject *parent) : QObject(*(new QmlComponentPrivate), parent) @@ -256,9 +263,12 @@ QmlComponent::QmlComponent(QmlEngine *engine, const QUrl &url, QObject *parent) } /*! - Create a QmlComponent from the given QML \a data. If provided, \a url - is used to set the component name, and to provide a base path for items - resolved by this component. + Create a QmlComponent from the given QML \a data and give it the + specified \a parent. If \a url is provided, it is used to set + the component name, and to provide a base path for items resolved + by this component. + + \sa setData() */ QmlComponent::QmlComponent(QmlEngine *engine, const QByteArray &data, const QUrl &url, QObject *parent) : QObject(*(new QmlComponentPrivate), parent) @@ -283,9 +293,9 @@ QmlComponent::QmlComponent(QmlEngine *engine, QmlCompiledComponent *cc, int star } /*! - Sets the QmlComponent to use the given QML \a data. If provided, - \a url is used to set the component name, and to provide a base path - for items resolved by this component. + Sets the QmlComponent to use the given QML \a data. If \a url + is provided, it is used to set the component name and to provide + a base path for items resolved by this component. */ void QmlComponent::setData(const QByteArray &data, const QUrl &url) { @@ -451,8 +461,7 @@ QObject *QmlComponent::beginCreate(QmlContext *context) QmlContext *ctxt = new QmlContext(context, 0); - static_cast<QmlContextPrivate*>(ctxt->d_ptr)->component = d->cc; - static_cast<QmlContextPrivate*>(ctxt->d_ptr)->component->addref(); + static_cast<QmlContextPrivate*>(ctxt->d_ptr)->url = d->cc->url; ctxt->activate(); QmlVME vme; diff --git a/src/declarative/qml/qmlcontext.cpp b/src/declarative/qml/qmlcontext.cpp index 30857ad..68453c3 100644 --- a/src/declarative/qml/qmlcontext.cpp +++ b/src/declarative/qml/qmlcontext.cpp @@ -42,7 +42,6 @@ #include <qmlcontext.h> #include <private/qmlcontext_p.h> #include <private/qmlengine_p.h> -#include <private/qmlcompiledcomponent_p.h> #include <qmlengine.h> #include <qscriptengine.h> @@ -54,7 +53,7 @@ QT_BEGIN_NAMESPACE QmlContextPrivate::QmlContextPrivate() - : parent(0), engine(0), highPriorityCount(0), component(0) + : parent(0), engine(0), highPriorityCount(0) { } @@ -232,8 +231,6 @@ QmlContext::QmlContext(QmlContext *parentContext, QObject *parent) */ QmlContext::~QmlContext() { - Q_D(QmlContext); - if (d->component) d->component->release(); } @@ -344,7 +341,7 @@ QmlContext *QmlContext::activeContext() simply returned. If there is no containing component, an empty URL is returned. - \sa QmlEngine::componentUrl() + \sa QmlEngine::componentUrl(), setBaseUrl() */ QUrl QmlContext::resolvedUrl(const QUrl &src) { @@ -352,14 +349,14 @@ QUrl QmlContext::resolvedUrl(const QUrl &src) if (src.isRelative()) { if (ctxt) { while(ctxt) { - if (ctxt->d_func()->component) + if(ctxt->d_func()->url.isValid()) break; else ctxt = ctxt->parentContext(); } if (ctxt) - return ctxt->d_func()->component->url.resolved(src); + return ctxt->d_func()->url.resolved(src); } return QUrl(); } else { @@ -373,7 +370,7 @@ QUrl QmlContext::resolvedUrl(const QUrl &src) \l {QmlEngine::nameSpacePaths()} {namespace paths} of the context's engine, returning the resolved URL. - \sa QmlEngine::componentUrl() + \sa QmlEngine::componentUrl(), setBaseUrl() */ QUrl QmlContext::resolvedUri(const QUrl &src) { @@ -381,14 +378,14 @@ QUrl QmlContext::resolvedUri(const QUrl &src) if (src.isRelative()) { if (ctxt) { while(ctxt) { - if (ctxt->d_func()->component) + if (ctxt->d_func()->url.isValid()) break; else ctxt = ctxt->parentContext(); } if (ctxt) - return ctxt->d_func()->engine->componentUrl(src, ctxt->d_func()->component->url); + return ctxt->d_func()->engine->componentUrl(src, ctxt->d_func()->url); } return QUrl(); } else { @@ -396,6 +393,20 @@ QUrl QmlContext::resolvedUri(const QUrl &src) } } +/*! + Explicitly sets the url both resolveUri() and resolveUrl() will + use for relative references to \a baseUrl. + + Calling this function will override the url of the containing + component used by default. + + \sa resolvedUrl(), resolvedUri() +*/ +void QmlContext::setBaseUrl(const QUrl &baseUrl) +{ + d_func()->url = baseUrl; +} + void QmlContext::objectDestroyed(QObject *object) { Q_D(QmlContext); diff --git a/src/declarative/qml/qmlcontext.h b/src/declarative/qml/qmlcontext.h index 9e3b6d8..39d565a 100644 --- a/src/declarative/qml/qmlcontext.h +++ b/src/declarative/qml/qmlcontext.h @@ -80,6 +80,8 @@ public: QUrl resolvedUri(const QUrl &); QUrl resolvedUrl(const QUrl &); + void setBaseUrl(const QUrl &); + private Q_SLOTS: void objectDestroyed(QObject *); diff --git a/src/declarative/qml/qmlcontext_p.h b/src/declarative/qml/qmlcontext_p.h index 3772885..40848fb 100644 --- a/src/declarative/qml/qmlcontext_p.h +++ b/src/declarative/qml/qmlcontext_p.h @@ -69,7 +69,8 @@ public: QScriptValueList scopeChain; - QmlCompiledComponent *component; + QUrl url; + void init(); void dump(); diff --git a/src/declarative/qml/qmlcustomparser.cpp b/src/declarative/qml/qmlcustomparser.cpp index 544c469..06035b0 100644 --- a/src/declarative/qml/qmlcustomparser.cpp +++ b/src/declarative/qml/qmlcustomparser.cpp @@ -52,11 +52,11 @@ using namespace QmlParser; \brief The QmlCustomParser class allows you to add new arbitrary types to QML. \internal - By subclassing QmlCustomParser, you can add an XML parser for building a - particular type. + By subclassing QmlCustomParser, you can add an XML parser for + building a particular type. - The subclass must implement compile() and create(), and define itself in - the meta type system with one of the macros: + The subclass must implement compile() and create(), and define + itself in the meta type system with one of the macros: \code QML_DEFINE_CUSTOM_PARSER(Name, parserClass) @@ -67,33 +67,39 @@ using namespace QmlParser; \endcode */ -/*! +/* \fn QByteArray QmlCustomParser::compile(QXmlStreamReader& reader, bool *ok) - Upon entry to this function, \a reader is positioned on a QXmlStreamReader::StartElement - with the name specified when the class was defined with the QML_DEFINE_CUSTOM_PARSER macro. + Upon entry to this function, \a reader is positioned on a + QXmlStreamReader::StartElement with the name specified when the + class was defined with the QML_DEFINE_CUSTOM_PARSER macro. - The custom parser must consume tokens from \a reader until the EndElement matching the - initial start element is reached, or until error. + The custom parser must consume tokens from \a reader until the + EndElement matching the initial start element is reached, or until + error. On return, \c *ok indicates success. - The returned QByteArray contains data meaningful only to the custom parser; the - type engine will pass this same data to create() when making an instance of the data. + The returned QByteArray contains data meaningful only to the + custom parser; the type engine will pass this same data to + create() when making an instance of the data. - The QByteArray may be cached between executions of the system, so it must contain - correctly-serialized data (not, for example, pointers to stack objects). + The QByteArray may be cached between executions of the system, so + it must contain correctly-serialized data (not, for example, + pointers to stack objects). */ -/*! +/* \fn QVariant QmlCustomParser::create(const QByteArray &data) - This function returns a QVariant containing the value represented by \a data, which - is a block of data previously returned by a call to compile(). + This function returns a QVariant containing the value represented + by \a data, which is a block of data previously returned by a call + to compile(). - If the compile is for a type, the variant should be a pointer to the - correctly-named QObject subclass (i.e. the one defined by QML_DEFINE_TYPE for - the same-named type as this custom parser is defined for). + If the compile is for a type, the variant should be a pointer to + the correctly-named QObject subclass (i.e. the one defined by + QML_DEFINE_TYPE for the same-named type as this custom parser is + defined for). */ QmlCustomParserNode diff --git a/src/declarative/qml/qmldom.h b/src/declarative/qml/qmldom.h index 74ed27c..daca888 100644 --- a/src/declarative/qml/qmldom.h +++ b/src/declarative/qml/qmldom.h @@ -73,7 +73,6 @@ public: int version() const; QList<QmlError> errors() const; - QString loadError() const; bool load(QmlEngine *, const QByteArray &); QByteArray save() const; diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp index f8b7ad6..bcea325 100644 --- a/src/declarative/qml/qmlengine.cpp +++ b/src/declarative/qml/qmlengine.cpp @@ -408,6 +408,9 @@ QmlEngine::~QmlEngine() { } +/*! + Clears the engine's internal component cache. + */ void QmlEngine::clearComponentCache() { Q_D(QmlEngine); @@ -582,8 +585,8 @@ void QmlEngine::setNetworkAccessManager(QNetworkAccessManager *network) } /*! - Returns the common QNetworkAccessManager used by all QML elements instantiated by - this engine. + Returns the common QNetworkAccessManager used by all QML elements + instantiated by this engine. The default implements no caching, cookiejar, etc., just a default QNetworkAccessManager. @@ -596,6 +599,9 @@ QNetworkAccessManager *QmlEngine::networkAccessManager() const return d->networkAccessManager; } +/*! + Returns the QmlContext for the \a object. + */ QmlContext *QmlEngine::contextForObject(const QObject *object) { QObjectPrivate *priv = QObjectPrivate::get(const_cast<QObject *>(object)); @@ -606,6 +612,11 @@ QmlContext *QmlEngine::contextForObject(const QObject *object) return data?data->context:0; } +/*! + Sets the QmlContext for the \a object to \a context. + If the \a object already has a context, a warning is + output, but the context is not changed. + */ void QmlEngine::setContextForObject(QObject *object, QmlContext *context) { QObjectPrivate *priv = QObjectPrivate::get(object); diff --git a/src/declarative/qml/qmlmetaproperty.cpp b/src/declarative/qml/qmlmetaproperty.cpp index 1a511eb..14a45dc 100644 --- a/src/declarative/qml/qmlmetaproperty.cpp +++ b/src/declarative/qml/qmlmetaproperty.cpp @@ -261,6 +261,33 @@ QmlMetaProperty::QmlMetaProperty(const QmlMetaProperty &other) } /*! + \enum QmlMetaProperty::PropertyCategory + + This enum specifies a category of QML property. + + \value Unknown + \value InvalidProperty + \value Bindable + \value List + \value QmlList + \value Object + \value Normal + */ + +/*! + \enum QmlMetaProperty::Type + + This enum specifies a type of QML property. + + \value Invalid + \value Property + \value SignalProperty + \value Signal + \value Default + \value Attached +*/ + +/*! Returns the property category. */ QmlMetaProperty::PropertyCategory QmlMetaProperty::propertyCategory() const @@ -472,13 +499,17 @@ QStringList QmlMetaProperty::properties(QObject *obj) } /*! - Return the name of this property. + Return the name of this QML property. */ QString QmlMetaProperty::name() const { return d->name; } +/*! + Returns the \l{QMetaProperty} {Qt property} associated with + this QML property. + */ const QMetaProperty &QmlMetaProperty::property() const { return d->prop; @@ -1037,9 +1068,10 @@ quint32 QmlMetaProperty::save() const } /*! - Restore a QmlMetaProperty from a previously saved id. \a obj must be the - same object as used in the previous call to QmlMetaProperty::save(). Only - the bottom 24-bits are used, the high bits can be set to any value. + Restore a QmlMetaProperty from a previously saved \a id. + \a obj must be the same object as used in the previous call + to QmlMetaProperty::save(). Only the bottom 24-bits are + used, the high bits can be set to any value. */ void QmlMetaProperty::restore(quint32 id, QObject *obj) { diff --git a/src/declarative/qml/qmlpropertyvaluesource.cpp b/src/declarative/qml/qmlpropertyvaluesource.cpp index 44e1952..4770929 100644 --- a/src/declarative/qml/qmlpropertyvaluesource.cpp +++ b/src/declarative/qml/qmlpropertyvaluesource.cpp @@ -59,14 +59,17 @@ QmlPropertyValueSource::QmlPropertyValueSource(QObject *parent) { } +/*! + \internal + */ QmlPropertyValueSource::QmlPropertyValueSource(QObjectPrivate &dd, QObject *parent) : QObject(dd, parent) { } /*! - Set the target \a property for the value source. This method will be called - by the QML engine when assigning a value source. + Set the target \a property for the value source. This method will + be called by the QML engine when assigning a value source. The default implementation does nothing. */ diff --git a/src/declarative/util/qfxview.cpp b/src/declarative/util/qfxview.cpp index f71b87e..1315f19 100644 --- a/src/declarative/util/qfxview.cpp +++ b/src/declarative/util/qfxview.cpp @@ -348,7 +348,7 @@ void QFxView::continueExecute() } /*! \fn void QFxView::sceneResized(QSize size) - This signal is emitted when the view is resized. + This signal is emitted when the view is resized to \a size. */ /*! @@ -458,7 +458,8 @@ void QFxView::resizeEvent(QResizeEvent *e) } /*! \fn void QFxView::focusInEvent(QFocusEvent *e) - This virtual function does nothing in this class. + This virtual function does nothing with the event \a e + in this class. */ void QFxView::focusInEvent(QFocusEvent *) { @@ -467,7 +468,8 @@ void QFxView::focusInEvent(QFocusEvent *) /*! \fn void QFxView::focusOutEvent(QFocusEvent *e) - This virtual function does nothing in this class. + This virtual function does nothing with the event \a e + in this class. */ void QFxView::focusOutEvent(QFocusEvent *) { diff --git a/src/declarative/util/qmlanimation.cpp b/src/declarative/util/qmlanimation.cpp index 4b8ce4e..08a7a28 100644 --- a/src/declarative/util/qmlanimation.cpp +++ b/src/declarative/util/qmlanimation.cpp @@ -703,9 +703,10 @@ QColor QmlColorAnimation::from() const void QmlColorAnimation::setFrom(const QColor &f) { Q_D(QmlColorAnimation); - if (d->fromValue.isValid() && f == d->fromValue) + if (d->fromIsDefined && f == d->fromValue) return; d->fromValue = f; + d->fromIsDefined = f.isValid(); emit fromChanged(f); } @@ -726,9 +727,10 @@ QColor QmlColorAnimation::to() const void QmlColorAnimation::setTo(const QColor &t) { Q_D(QmlColorAnimation); - if (d->toValue.isValid() && t == d->toValue) + if (d->toIsDefined && t == d->toValue) return; d->toValue = t; + d->toIsDefined = t.isValid(); emit toChanged(t); } @@ -860,9 +862,13 @@ void QmlColorAnimation::transition(QmlStateActions &actions, (!target() || target() == obj)) { objs.insert(obj); Action myAction = action; - if (d->fromValue.isValid()) + + if (d->fromIsDefined) { myAction.fromValue = QVariant(d->fromValue); - if (d->toValue.isValid()) + } else { + myAction.fromValue = QVariant(); + } + if (d->toIsDefined) myAction.toValue = QVariant(d->toValue); modified << action.property; @@ -877,7 +883,7 @@ void QmlColorAnimation::transition(QmlStateActions &actions, Action myAction; myAction.property = QmlMetaProperty(obj, props.at(jj)); - if (d->fromValue.isValid()) + if (d->fromIsDefined) myAction.fromValue = QVariant(d->fromValue); myAction.toValue = QVariant(d->toValue); @@ -898,7 +904,7 @@ QVariantAnimation::Interpolator QmlColorAnimationPrivate::colorInterpolator = 0; void QmlColorAnimationPrivate::valueChanged(qreal v) { if (!fromSourced) { - if (!fromValue.isValid()) { + if (!fromIsDefined) { fromValue = qvariant_cast<QColor>(property.read()); } fromSourced = true; @@ -1993,9 +1999,10 @@ QVariant QmlVariantAnimation::from() const void QmlVariantAnimation::setFrom(const QVariant &f) { Q_D(QmlVariantAnimation); - if (d->from.isValid() && f == d->from) + if (d->fromIsDefined && f == d->from) return; d->from = f; + d->fromIsDefined = f.isValid(); emit fromChanged(f); } @@ -2017,9 +2024,10 @@ QVariant QmlVariantAnimation::to() const void QmlVariantAnimation::setTo(const QVariant &t) { Q_D(QmlVariantAnimation); - if (d->to.isValid() && t == d->to) + if (d->toIsDefined && t == d->to) return; d->to = t; + d->toIsDefined = t.isValid(); emit toChanged(t); } @@ -2109,7 +2117,7 @@ QList<QObject *> *QmlVariantAnimation::exclude() void QmlVariantAnimationPrivate::valueChanged(qreal r) { if (!fromSourced) { - if (!from.isValid()) { + if (!fromIsDefined) { from = property.read(); } fromSourced = true; @@ -2138,7 +2146,7 @@ void QmlVariantAnimation::prepare(QmlMetaProperty &p) d->property = d->userProperty; d->convertVariant(d->to, (QVariant::Type)d->property.propertyType()); - if (d->from.isValid()) + if (d->fromIsDefined) d->convertVariant(d->from, (QVariant::Type)d->property.propertyType()); d->fromSourced = false; @@ -2198,12 +2206,12 @@ void QmlVariantAnimation::transition(QmlStateActions &actions, objs.insert(obj); Action myAction = action; - if (d->from.isValid()) { + if (d->fromIsDefined) { myAction.fromValue = d->from; } else { myAction.fromValue = QVariant(); } - if (d->to.isValid()) + if (d->toIsDefined) myAction.toValue = d->to; d->convertVariant(myAction.fromValue, (QVariant::Type)myAction.property.propertyType()); @@ -2216,13 +2224,13 @@ void QmlVariantAnimation::transition(QmlStateActions &actions, } } - if (d->to.isValid() && target() && !objs.contains(target())) { + if (d->toIsDefined && target() && !objs.contains(target())) { QObject *obj = target(); for (int jj = 0; jj < props.count(); ++jj) { Action myAction; myAction.property = QmlMetaProperty(obj, props.at(jj)); - if (d->from.isValid()) { + if (d->fromIsDefined) { d->convertVariant(d->from, (QVariant::Type)myAction.property.propertyType()); myAction.fromValue = d->from; } diff --git a/src/declarative/util/qmlanimation_p.h b/src/declarative/util/qmlanimation_p.h index 4fcaa47..06b7c08 100644 --- a/src/declarative/util/qmlanimation_p.h +++ b/src/declarative/util/qmlanimation_p.h @@ -203,7 +203,8 @@ class QmlColorAnimationPrivate : public QmlAbstractAnimationPrivate Q_DECLARE_PUBLIC(QmlColorAnimation); public: QmlColorAnimationPrivate() - : QmlAbstractAnimationPrivate(), fromSourced(false), ca(0), value(this, &QmlColorAnimationPrivate::valueChanged) + : QmlAbstractAnimationPrivate(), fromSourced(false), fromIsDefined(false), toIsDefined(false), + ca(0), value(this, &QmlColorAnimationPrivate::valueChanged) { if (!colorInterpolator) colorInterpolator = QVariantAnimationPrivate::getInterpolator(QVariant::Color); @@ -213,11 +214,16 @@ public: QString easing; + QColor fromValue; + QColor toValue; + QList<QObject *> filter; QList<QObject *> exclude; + bool fromSourced; - QColor fromValue; - QColor toValue; + bool fromIsDefined; + bool toIsDefined; + QmlTimeLineValueAnimator *ca; virtual void valueChanged(qreal); @@ -350,7 +356,8 @@ class QmlVariantAnimationPrivate : public QmlAbstractAnimationPrivate Q_DECLARE_PUBLIC(QmlVariantAnimation); public: QmlVariantAnimationPrivate() - : QmlAbstractAnimationPrivate(), fromSourced(false), va(0), value(this, &QmlVariantAnimationPrivate::valueChanged) {} + : QmlAbstractAnimationPrivate(), fromSourced(false), fromIsDefined(false), toIsDefined(false), + va(0), value(this, &QmlVariantAnimationPrivate::valueChanged) {} void init(); @@ -364,6 +371,8 @@ public: QList<QObject *> exclude; bool fromSourced; + bool fromIsDefined; + bool toIsDefined; QmlTimeLineValueAnimator *va; virtual void valueChanged(qreal); |