From c8823023db4a280f3d12c983451a05f8da3780dd Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Thu, 25 Feb 2010 16:29:26 +1000 Subject: Make more private QDeclarativeMetaProperty methods private --- src/declarative/qml/qdeclarativebinding.cpp | 8 +++--- src/declarative/qml/qdeclarativebinding_p.h | 15 +++++------ .../qml/qdeclarativecompiledbindings.cpp | 10 ++++---- src/declarative/qml/qdeclarativecomponent.cpp | 4 +-- src/declarative/qml/qdeclarativemetaproperty.cpp | 29 +++++++++++----------- src/declarative/qml/qdeclarativemetaproperty.h | 10 ++------ src/declarative/qml/qdeclarativemetaproperty_p.h | 16 ++++++++---- src/declarative/qml/qdeclarativevaluetype.cpp | 18 +++++++------- src/declarative/qml/qdeclarativevaluetype_p.h | 21 ++++++++-------- src/declarative/qml/qdeclarativevme.cpp | 7 +++--- src/declarative/qml/qdeclarativevmemetaobject.cpp | 2 +- src/declarative/util/qdeclarativeanimation.cpp | 7 +++--- src/declarative/util/qdeclarativebehavior.cpp | 5 ++-- .../util/qdeclarativetransitionmanager.cpp | 7 +++--- .../tst_qdeclarativemetaproperty.cpp | 22 ++++++++-------- .../declarative/qdeclarativevaluetypes/testtypes.h | 3 ++- 16 files changed, 95 insertions(+), 89 deletions(-) diff --git a/src/declarative/qml/qdeclarativebinding.cpp b/src/declarative/qml/qdeclarativebinding.cpp index bde01ae..720c562 100644 --- a/src/declarative/qml/qdeclarativebinding.cpp +++ b/src/declarative/qml/qdeclarativebinding.cpp @@ -111,7 +111,7 @@ QDeclarativeMetaProperty QDeclarativeBinding::property() const return d->bindingData()->property; } -void QDeclarativeBinding::update(QDeclarativeMetaProperty::WriteFlags flags) +void QDeclarativeBinding::update(QDeclarativeMetaPropertyPrivate::WriteFlags flags) { Q_D(QDeclarativeBinding); @@ -161,7 +161,7 @@ void QDeclarativeBinding::update(QDeclarativeMetaProperty::WriteFlags flags) data->error.setDescription(QLatin1String("Unable to assign [undefined] to ") + QLatin1String(QMetaType::typeName(data->property.propertyType()))); } else if (!isUndefined && data->property.object() && - !data->property.write(value, flags)) { + !QDeclarativeMetaPropertyPrivate::write(data->property, value, flags)) { QUrl url = QUrl(data->url); int line = data->line; @@ -204,7 +204,7 @@ void QDeclarativeBindingPrivate::emitValueChanged() q->update(); } -void QDeclarativeBinding::setEnabled(bool e, QDeclarativeMetaProperty::WriteFlags flags) +void QDeclarativeBinding::setEnabled(bool e, QDeclarativeMetaPropertyPrivate::WriteFlags flags) { Q_D(QDeclarativeBinding); d->bindingData()->enabled = e; @@ -300,7 +300,7 @@ QString QDeclarativeAbstractBinding::expression() const return QLatin1String(""); } -void QDeclarativeAbstractBinding::setEnabled(bool e, QDeclarativeMetaProperty::WriteFlags) +void QDeclarativeAbstractBinding::setEnabled(bool e, QDeclarativeMetaPropertyPrivate::WriteFlags) { if (e) m_mePtr = 0; } diff --git a/src/declarative/qml/qdeclarativebinding_p.h b/src/declarative/qml/qdeclarativebinding_p.h index 7c79b8c..ac174fa 100644 --- a/src/declarative/qml/qdeclarativebinding_p.h +++ b/src/declarative/qml/qdeclarativebinding_p.h @@ -57,6 +57,7 @@ #include "qdeclarativepropertyvaluesource.h" #include "qdeclarativeexpression.h" #include "qdeclarativemetaproperty.h" +#include "qdeclarativemetaproperty_p.h" #include #include @@ -73,12 +74,12 @@ public: virtual QString expression() const; - void setEnabled(bool e) { setEnabled(e, QDeclarativeMetaProperty::DontRemoveBinding); } - virtual void setEnabled(bool, QDeclarativeMetaProperty::WriteFlags) = 0; + void setEnabled(bool e) { setEnabled(e, QDeclarativeMetaPropertyPrivate::DontRemoveBinding); } + virtual void setEnabled(bool, QDeclarativeMetaPropertyPrivate::WriteFlags) = 0; virtual int propertyIndex() = 0; - void update() { update(QDeclarativeMetaProperty::DontRemoveBinding); } - virtual void update(QDeclarativeMetaProperty::WriteFlags) = 0; + void update() { update(QDeclarativeMetaPropertyPrivate::DontRemoveBinding); } + virtual void update(QDeclarativeMetaPropertyPrivate::WriteFlags) = 0; void addToObject(QObject *); void removeFromObject(); @@ -115,13 +116,13 @@ public: bool enabled() const; // Inherited from QDeclarativeAbstractBinding - virtual void setEnabled(bool, QDeclarativeMetaProperty::WriteFlags flags); + virtual void setEnabled(bool, QDeclarativeMetaPropertyPrivate::WriteFlags flags); virtual int propertyIndex(); - virtual void update(QDeclarativeMetaProperty::WriteFlags flags); + virtual void update(QDeclarativeMetaPropertyPrivate::WriteFlags flags); virtual QString expression() const; public Q_SLOTS: - void update() { update(QDeclarativeMetaProperty::DontRemoveBinding); } + void update() { update(QDeclarativeMetaPropertyPrivate::DontRemoveBinding); } protected: void emitValueChanged(); diff --git a/src/declarative/qml/qdeclarativecompiledbindings.cpp b/src/declarative/qml/qdeclarativecompiledbindings.cpp index face22c..a88f02e 100644 --- a/src/declarative/qml/qdeclarativecompiledbindings.cpp +++ b/src/declarative/qml/qdeclarativecompiledbindings.cpp @@ -109,9 +109,9 @@ public: scope(0), target(0), parent(0) {} // Inherited from QDeclarativeAbstractBinding - virtual void setEnabled(bool, QDeclarativeMetaProperty::WriteFlags flags); + virtual void setEnabled(bool, QDeclarativeMetaPropertyPrivate::WriteFlags flags); virtual int propertyIndex(); - virtual void update(QDeclarativeMetaProperty::WriteFlags flags); + virtual void update(QDeclarativeMetaPropertyPrivate::WriteFlags flags); virtual void destroy(); int index:30; @@ -244,7 +244,7 @@ QDeclarativeAbstractBinding *QDeclarativeCompiledBindings::configBinding(int ind return rv; } -void QDeclarativeCompiledBindingsPrivate::Binding::setEnabled(bool e, QDeclarativeMetaProperty::WriteFlags flags) +void QDeclarativeCompiledBindingsPrivate::Binding::setEnabled(bool e, QDeclarativeMetaPropertyPrivate::WriteFlags flags) { if (e) { addToObject(target); @@ -267,7 +267,7 @@ int QDeclarativeCompiledBindingsPrivate::Binding::propertyIndex() return property & 0xFFFF; } -void QDeclarativeCompiledBindingsPrivate::Binding::update(QDeclarativeMetaProperty::WriteFlags) +void QDeclarativeCompiledBindingsPrivate::Binding::update(QDeclarativeMetaPropertyPrivate::WriteFlags) { parent->run(this); } @@ -324,7 +324,7 @@ void QDeclarativeCompiledBindingsPrivate::run(Binding *binding) run(binding->index, cp, binding, binding->scope, target); vt->write(binding->target, binding->property & 0xFFFF, - QDeclarativeMetaProperty::DontRemoveBinding); + QDeclarativeMetaPropertyPrivate::DontRemoveBinding); } else { run(binding->index, cp, binding, binding->scope, binding->target); } diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp index beaba4a..aaf36e0 100644 --- a/src/declarative/qml/qdeclarativecomponent.cpp +++ b/src/declarative/qml/qdeclarativecomponent.cpp @@ -698,8 +698,8 @@ void QDeclarativeComponentPrivate::complete(QDeclarativeEnginePrivate *enginePri state->bindValues.at(ii); for (int jj = 0; jj < bv.count; ++jj) { if(bv.at(jj)) - bv.at(jj)->setEnabled(true, QDeclarativeMetaProperty::BypassInterceptor | - QDeclarativeMetaProperty::DontRemoveBinding); + bv.at(jj)->setEnabled(true, QDeclarativeMetaPropertyPrivate::BypassInterceptor | + QDeclarativeMetaPropertyPrivate::DontRemoveBinding); } QDeclarativeEnginePrivate::clear(bv); } diff --git a/src/declarative/qml/qdeclarativemetaproperty.cpp b/src/declarative/qml/qdeclarativemetaproperty.cpp index f4c930f..a976140 100644 --- a/src/declarative/qml/qdeclarativemetaproperty.cpp +++ b/src/declarative/qml/qdeclarativemetaproperty.cpp @@ -589,7 +589,7 @@ QDeclarativeMetaPropertyPrivate::binding(const QDeclarativeMetaProperty &that) QDeclarativeAbstractBinding * QDeclarativeMetaPropertyPrivate::setBinding(const QDeclarativeMetaProperty &that, QDeclarativeAbstractBinding *newBinding, - QDeclarativeMetaProperty::WriteFlags flags) + WriteFlags flags) { if (!that.isProperty() || !that.d->object) { if (newBinding) @@ -602,7 +602,7 @@ QDeclarativeMetaPropertyPrivate::setBinding(const QDeclarativeMetaProperty &that QDeclarativeAbstractBinding * QDeclarativeMetaPropertyPrivate::setBinding(QObject *object, const QDeclarativePropertyCache::Data &core, - QDeclarativeAbstractBinding *newBinding, QDeclarativeMetaProperty::WriteFlags flags) + QDeclarativeAbstractBinding *newBinding, WriteFlags flags) { QDeclarativeDeclarativeData *data = QDeclarativeDeclarativeData::get(object, 0 != newBinding); @@ -796,11 +796,10 @@ bool QDeclarativeMetaPropertyPrivate::writeEnumProperty(const QMetaProperty &pro return status; } -bool QDeclarativeMetaPropertyPrivate::writeValueProperty(const QVariant &value, - QDeclarativeMetaProperty::WriteFlags flags) +bool QDeclarativeMetaPropertyPrivate::writeValueProperty(const QVariant &value, WriteFlags flags) { // Remove any existing bindings on this property - if (!(flags & QDeclarativeMetaProperty::DontRemoveBinding)) { + if (!(flags & DontRemoveBinding)) { QDeclarativeAbstractBinding *binding = setBinding(*q, 0); if (binding) binding->destroy(); } @@ -838,8 +837,8 @@ bool QDeclarativeMetaPropertyPrivate::writeValueProperty(const QVariant &value, } bool QDeclarativeMetaPropertyPrivate::write(QObject *object, const QDeclarativePropertyCache::Data &property, - const QVariant &value, QDeclarativeContext *context, - QDeclarativeMetaProperty::WriteFlags flags) + const QVariant &value, QDeclarativeContext *context, + WriteFlags flags) { int coreIdx = property.coreIndex; int status = -1; //for dbus @@ -1007,7 +1006,7 @@ const QMetaObject *QDeclarativeMetaPropertyPrivate::rawMetaObjectForType(QDeclar */ bool QDeclarativeMetaProperty::write(const QVariant &value) const { - return write(value, 0); + return QDeclarativeMetaPropertyPrivate::write(*this, value, 0); } /*! @@ -1024,10 +1023,12 @@ bool QDeclarativeMetaProperty::reset() const } } -bool QDeclarativeMetaProperty::write(const QVariant &value, QDeclarativeMetaProperty::WriteFlags flags) const +bool QDeclarativeMetaPropertyPrivate::write(const QDeclarativeMetaProperty &that, + const QVariant &value, WriteFlags flags) { - if (d->object && type() & Property && d->core.isValid() && isWritable()) - return d->writeValueProperty(value, flags); + if (that.d->object && that.type() & QDeclarativeMetaProperty::Property && + that.d->core.isValid() && that.isWritable()) + return that.d->writeValueProperty(value, flags); else return false; } @@ -1106,13 +1107,11 @@ int QDeclarativeMetaProperty::coreIndex() const return d->core.coreIndex; } -/*! \internal */ -int QDeclarativeMetaProperty::valueTypeCoreIndex() const +int QDeclarativeMetaPropertyPrivate::valueTypeCoreIndex(const QDeclarativeMetaProperty &that) { - return d->valueType.valueTypeCoreIdx; + return that.d->valueType.valueTypeCoreIdx; } - struct SerializedData { QDeclarativeMetaProperty::Type type; QDeclarativePropertyCache::Data core; diff --git a/src/declarative/qml/qdeclarativemetaproperty.h b/src/declarative/qml/qdeclarativemetaproperty.h index 900d1cd..828749f 100644 --- a/src/declarative/qml/qdeclarativemetaproperty.h +++ b/src/declarative/qml/qdeclarativemetaproperty.h @@ -93,9 +93,6 @@ public: QVariant read() const; bool write(const QVariant &) const; - enum WriteFlag { BypassInterceptor = 0x01, DontRemoveBinding = 0x02 }; - Q_DECLARE_FLAGS(WriteFlags, WriteFlag) - bool write(const QVariant &, QDeclarativeMetaProperty::WriteFlags) const; bool reset() const; bool hasChangedNotifier() const; @@ -103,8 +100,6 @@ public: bool connectNotifier(QObject *dest, const char *slot) const; bool connectNotifier(QObject *dest, int method) const; - QMetaMethod method() const; - Type type() const; bool isProperty() const; bool isDefault() const; @@ -120,17 +115,16 @@ public: bool operator==(const QDeclarativeMetaProperty &) const; + int coreIndex() const; QMetaProperty property() const; + QMetaMethod method() const; - int coreIndex() const; - int valueTypeCoreIndex() const; private: friend class QDeclarativeEnginePrivate; friend class QDeclarativeMetaPropertyPrivate; QDeclarativeMetaPropertyPrivate *d; }; typedef QList QDeclarativeMetaProperties; - Q_DECLARE_OPERATORS_FOR_FLAGS(QDeclarativeMetaProperty::WriteFlags) QT_END_NAMESPACE diff --git a/src/declarative/qml/qdeclarativemetaproperty_p.h b/src/declarative/qml/qdeclarativemetaproperty_p.h index 937cfd7..a171545 100644 --- a/src/declarative/qml/qdeclarativemetaproperty_p.h +++ b/src/declarative/qml/qdeclarativemetaproperty_p.h @@ -67,6 +67,9 @@ class QDeclarativeEnginePrivate; class Q_AUTOTEST_EXPORT QDeclarativeMetaPropertyPrivate { public: + enum WriteFlag { BypassInterceptor = 0x01, DontRemoveBinding = 0x02 }; + Q_DECLARE_FLAGS(WriteFlags, WriteFlag) + QDeclarativeMetaPropertyPrivate() : q(0), context(0), object(0), isDefaultProperty(false), isNameCached(false) {} @@ -98,16 +101,16 @@ public: QDeclarativeMetaProperty::PropertyTypeCategory propertyTypeCategory() const; QVariant readValueProperty(); - bool writeValueProperty(const QVariant &, QDeclarativeMetaProperty::WriteFlags); + bool writeValueProperty(const QVariant &, WriteFlags); static const QMetaObject *rawMetaObjectForType(QDeclarativeEnginePrivate *, int); static bool writeEnumProperty(const QMetaProperty &prop, int idx, QObject *object, const QVariant &value, int flags); static bool write(QObject *, const QDeclarativePropertyCache::Data &, const QVariant &, - QDeclarativeContext *, QDeclarativeMetaProperty::WriteFlags flags = 0); + QDeclarativeContext *, WriteFlags flags = 0); static QDeclarativeAbstractBinding *setBinding(QObject *, const QDeclarativePropertyCache::Data &, QDeclarativeAbstractBinding *, - QDeclarativeMetaProperty::WriteFlags flags = QDeclarativeMetaProperty::DontRemoveBinding); + WriteFlags flags = DontRemoveBinding); static QByteArray saveValueType(const QMetaObject *, int, const QMetaObject *, int); @@ -122,13 +125,16 @@ public: static QDeclarativeAbstractBinding *binding(const QDeclarativeMetaProperty &that); static QDeclarativeAbstractBinding *setBinding(const QDeclarativeMetaProperty &that, QDeclarativeAbstractBinding *, - QDeclarativeMetaProperty::WriteFlags flags = QDeclarativeMetaProperty::DontRemoveBinding); + WriteFlags flags = DontRemoveBinding); static QDeclarativeExpression *signalExpression(const QDeclarativeMetaProperty &that); static QDeclarativeExpression *setSignalExpression(const QDeclarativeMetaProperty &that, QDeclarativeExpression *) ; - + static bool write(const QDeclarativeMetaProperty &that, const QVariant &, WriteFlags); + static int valueTypeCoreIndex(const QDeclarativeMetaProperty &that); }; +Q_DECLARE_OPERATORS_FOR_FLAGS(QDeclarativeMetaPropertyPrivate::WriteFlags) + QT_END_NAMESPACE #endif // QDECLARATIVEMETAPROPERTY_P_H diff --git a/src/declarative/qml/qdeclarativevaluetype.cpp b/src/declarative/qml/qdeclarativevaluetype.cpp index df83fa4..d35371f 100644 --- a/src/declarative/qml/qdeclarativevaluetype.cpp +++ b/src/declarative/qml/qdeclarativevaluetype.cpp @@ -100,7 +100,7 @@ void QDeclarativePointFValueType::read(QObject *obj, int idx) QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a); } -void QDeclarativePointFValueType::write(QObject *obj, int idx, QDeclarativeMetaProperty::WriteFlags flags) +void QDeclarativePointFValueType::write(QObject *obj, int idx, QDeclarativeMetaPropertyPrivate::WriteFlags flags) { int status = -1; void *a[] = { &point, 0, &status, &flags }; @@ -148,7 +148,7 @@ void QDeclarativePointValueType::read(QObject *obj, int idx) QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a); } -void QDeclarativePointValueType::write(QObject *obj, int idx, QDeclarativeMetaProperty::WriteFlags flags) +void QDeclarativePointValueType::write(QObject *obj, int idx, QDeclarativeMetaPropertyPrivate::WriteFlags flags) { int status = -1; void *a[] = { &point, 0, &status, &flags }; @@ -196,7 +196,7 @@ void QDeclarativeSizeFValueType::read(QObject *obj, int idx) QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a); } -void QDeclarativeSizeFValueType::write(QObject *obj, int idx, QDeclarativeMetaProperty::WriteFlags flags) +void QDeclarativeSizeFValueType::write(QObject *obj, int idx, QDeclarativeMetaPropertyPrivate::WriteFlags flags) { int status = -1; void *a[] = { &size, 0, &status, &flags }; @@ -244,7 +244,7 @@ void QDeclarativeSizeValueType::read(QObject *obj, int idx) QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a); } -void QDeclarativeSizeValueType::write(QObject *obj, int idx, QDeclarativeMetaProperty::WriteFlags flags) +void QDeclarativeSizeValueType::write(QObject *obj, int idx, QDeclarativeMetaPropertyPrivate::WriteFlags flags) { int status = -1; void *a[] = { &size, 0, &status, &flags }; @@ -292,7 +292,7 @@ void QDeclarativeRectFValueType::read(QObject *obj, int idx) QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a); } -void QDeclarativeRectFValueType::write(QObject *obj, int idx, QDeclarativeMetaProperty::WriteFlags flags) +void QDeclarativeRectFValueType::write(QObject *obj, int idx, QDeclarativeMetaPropertyPrivate::WriteFlags flags) { int status = -1; void *a[] = { &rect, 0, &status, &flags }; @@ -360,7 +360,7 @@ void QDeclarativeRectValueType::read(QObject *obj, int idx) QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a); } -void QDeclarativeRectValueType::write(QObject *obj, int idx, QDeclarativeMetaProperty::WriteFlags flags) +void QDeclarativeRectValueType::write(QObject *obj, int idx, QDeclarativeMetaPropertyPrivate::WriteFlags flags) { int status = -1; void *a[] = { &rect, 0, &status, &flags }; @@ -428,7 +428,7 @@ void QDeclarativeVector3DValueType::read(QObject *obj, int idx) QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a); } -void QDeclarativeVector3DValueType::write(QObject *obj, int idx, QDeclarativeMetaProperty::WriteFlags flags) +void QDeclarativeVector3DValueType::write(QObject *obj, int idx, QDeclarativeMetaPropertyPrivate::WriteFlags flags) { int status = -1; void *a[] = { &vector, 0, &status, &flags }; @@ -486,7 +486,7 @@ void QDeclarativeEasingValueType::read(QObject *obj, int idx) QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a); } -void QDeclarativeEasingValueType::write(QObject *obj, int idx, QDeclarativeMetaProperty::WriteFlags flags) +void QDeclarativeEasingValueType::write(QObject *obj, int idx, QDeclarativeMetaPropertyPrivate::WriteFlags flags) { int status = -1; void *a[] = { &easing, 0, &status, &flags }; @@ -554,7 +554,7 @@ void QDeclarativeFontValueType::read(QObject *obj, int idx) QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a); } -void QDeclarativeFontValueType::write(QObject *obj, int idx, QDeclarativeMetaProperty::WriteFlags flags) +void QDeclarativeFontValueType::write(QObject *obj, int idx, QDeclarativeMetaPropertyPrivate::WriteFlags flags) { int status = -1; void *a[] = { &font, 0, &status, &flags }; diff --git a/src/declarative/qml/qdeclarativevaluetype_p.h b/src/declarative/qml/qdeclarativevaluetype_p.h index 995433b..792598b 100644 --- a/src/declarative/qml/qdeclarativevaluetype_p.h +++ b/src/declarative/qml/qdeclarativevaluetype_p.h @@ -54,6 +54,7 @@ // #include "qdeclarativemetaproperty.h" +#include "qdeclarativemetaproperty_p.h" #include #include @@ -70,7 +71,7 @@ class Q_DECLARATIVE_EXPORT QDeclarativeValueType : public QObject public: QDeclarativeValueType(QObject *parent = 0); virtual void read(QObject *, int) = 0; - virtual void write(QObject *, int, QDeclarativeMetaProperty::WriteFlags flags) = 0; + virtual void write(QObject *, int, QDeclarativeMetaPropertyPrivate::WriteFlags flags) = 0; virtual QVariant value() = 0; virtual void setValue(QVariant) = 0; }; @@ -95,7 +96,7 @@ public: QDeclarativePointFValueType(QObject *parent = 0); virtual void read(QObject *, int); - virtual void write(QObject *, int, QDeclarativeMetaProperty::WriteFlags); + virtual void write(QObject *, int, QDeclarativeMetaPropertyPrivate::WriteFlags); virtual QVariant value(); virtual void setValue(QVariant value); @@ -117,7 +118,7 @@ public: QDeclarativePointValueType(QObject *parent = 0); virtual void read(QObject *, int); - virtual void write(QObject *, int, QDeclarativeMetaProperty::WriteFlags); + virtual void write(QObject *, int, QDeclarativeMetaPropertyPrivate::WriteFlags); virtual QVariant value(); virtual void setValue(QVariant value); @@ -139,7 +140,7 @@ public: QDeclarativeSizeFValueType(QObject *parent = 0); virtual void read(QObject *, int); - virtual void write(QObject *, int, QDeclarativeMetaProperty::WriteFlags); + virtual void write(QObject *, int, QDeclarativeMetaPropertyPrivate::WriteFlags); virtual QVariant value(); virtual void setValue(QVariant value); @@ -161,7 +162,7 @@ public: QDeclarativeSizeValueType(QObject *parent = 0); virtual void read(QObject *, int); - virtual void write(QObject *, int, QDeclarativeMetaProperty::WriteFlags); + virtual void write(QObject *, int, QDeclarativeMetaPropertyPrivate::WriteFlags); virtual QVariant value(); virtual void setValue(QVariant value); @@ -185,7 +186,7 @@ public: QDeclarativeRectFValueType(QObject *parent = 0); virtual void read(QObject *, int); - virtual void write(QObject *, int, QDeclarativeMetaProperty::WriteFlags); + virtual void write(QObject *, int, QDeclarativeMetaPropertyPrivate::WriteFlags); virtual QVariant value(); virtual void setValue(QVariant value); @@ -214,7 +215,7 @@ public: QDeclarativeRectValueType(QObject *parent = 0); virtual void read(QObject *, int); - virtual void write(QObject *, int, QDeclarativeMetaProperty::WriteFlags); + virtual void write(QObject *, int, QDeclarativeMetaPropertyPrivate::WriteFlags); virtual QVariant value(); virtual void setValue(QVariant value); @@ -242,7 +243,7 @@ public: QDeclarativeVector3DValueType(QObject *parent = 0); virtual void read(QObject *, int); - virtual void write(QObject *, int, QDeclarativeMetaProperty::WriteFlags); + virtual void write(QObject *, int, QDeclarativeMetaPropertyPrivate::WriteFlags); virtual QVariant value(); virtual void setValue(QVariant value); @@ -296,7 +297,7 @@ public: QDeclarativeEasingValueType(QObject *parent = 0); virtual void read(QObject *, int); - virtual void write(QObject *, int, QDeclarativeMetaProperty::WriteFlags); + virtual void write(QObject *, int, QDeclarativeMetaPropertyPrivate::WriteFlags); virtual QVariant value(); virtual void setValue(QVariant value); @@ -347,7 +348,7 @@ public: QDeclarativeFontValueType(QObject *parent = 0); virtual void read(QObject *, int); - virtual void write(QObject *, int, QDeclarativeMetaProperty::WriteFlags); + virtual void write(QObject *, int, QDeclarativeMetaPropertyPrivate::WriteFlags); virtual QVariant value(); virtual void setValue(QVariant value); diff --git a/src/declarative/qml/qdeclarativevme.cpp b/src/declarative/qml/qdeclarativevme.cpp index d1140a6..f7af843 100644 --- a/src/declarative/qml/qdeclarativevme.cpp +++ b/src/declarative/qml/qdeclarativevme.cpp @@ -156,7 +156,7 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack &stack, QDeclarati QDeclarativeContextPrivate *cp = (QDeclarativeContextPrivate *)QObjectPrivate::get(ctxt); int status = -1; //for dbus - QDeclarativeMetaProperty::WriteFlags flags = QDeclarativeMetaProperty::BypassInterceptor; + QDeclarativeMetaPropertyPrivate::WriteFlags flags = QDeclarativeMetaPropertyPrivate::BypassInterceptor; for (int ii = start; !isError() && ii < (start + count); ++ii) { const QDeclarativeInstruction &instr = comp->bytecode.at(ii); @@ -648,7 +648,7 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack &stack, QDeclarati obj->setParent(target); vi->setTarget(prop); QDeclarativeVMEMetaObject *mo = static_cast((QMetaObject*)target->metaObject()); - mo->registerInterceptor(prop.coreIndex(), prop.valueTypeCoreIndex(), vi); + mo->registerInterceptor(prop.coreIndex(), QDeclarativeMetaPropertyPrivate::valueTypeCoreIndex(prop), vi); } break; @@ -806,7 +806,8 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack &stack, QDeclarati QDeclarativeValueType *valueHandler = static_cast(stack.pop()); QObject *target = stack.top(); - valueHandler->write(target, instr.fetchValue.property, QDeclarativeMetaProperty::BypassInterceptor); + valueHandler->write(target, instr.fetchValue.property, + QDeclarativeMetaPropertyPrivate::BypassInterceptor); } break; diff --git a/src/declarative/qml/qdeclarativevmemetaobject.cpp b/src/declarative/qml/qdeclarativevmemetaobject.cpp index 6811e13..6edb707 100644 --- a/src/declarative/qml/qdeclarativevmemetaobject.cpp +++ b/src/declarative/qml/qdeclarativevmemetaobject.cpp @@ -105,7 +105,7 @@ int QDeclarativeVMEMetaObject::metaCall(QMetaObject::Call c, int _id, void **a) int id = _id; if(c == QMetaObject::WriteProperty) { int flags = *reinterpret_cast(a[3]); - if (!(flags & QDeclarativeMetaProperty::BypassInterceptor) + if (!(flags & QDeclarativeMetaPropertyPrivate::BypassInterceptor) && !aInterceptors.isEmpty() && aInterceptors.testBit(id)) { QPair pair = interceptors.value(id); diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp index 9e777a0..a327ccb 100644 --- a/src/declarative/util/qdeclarativeanimation.cpp +++ b/src/declarative/util/qdeclarativeanimation.cpp @@ -52,6 +52,7 @@ #include #include #include +#include #include #include @@ -924,7 +925,7 @@ void QDeclarativePropertyAction::transition(QDeclarativeStateActions &actions, { for (int ii = 0; ii < actions.count(); ++ii) { const QDeclarativeAction &action = actions.at(ii); - action.property.write(action.toValue, QDeclarativeMetaProperty::BypassInterceptor | QDeclarativeMetaProperty::DontRemoveBinding); + QDeclarativeMetaPropertyPrivate::write(action.property, action.toValue, QDeclarativeMetaPropertyPrivate::BypassInterceptor | QDeclarativeMetaPropertyPrivate::DontRemoveBinding); } } }; @@ -2230,7 +2231,7 @@ struct PropertyUpdater : public QDeclarativeTimeLineValue QDeclarativeAction &action = actions[ii]; if (v == 1.) - action.property.write(action.toValue, QDeclarativeMetaProperty::BypassInterceptor | QDeclarativeMetaProperty::DontRemoveBinding); + QDeclarativeMetaPropertyPrivate::write(action.property, action.toValue, QDeclarativeMetaPropertyPrivate::BypassInterceptor | QDeclarativeMetaPropertyPrivate::DontRemoveBinding); else { if (!fromSourced && !fromDefined) { action.fromValue = action.property.read(); @@ -2245,7 +2246,7 @@ struct PropertyUpdater : public QDeclarativeTimeLineValue } } if (interpolator) - action.property.write(interpolator(action.fromValue.constData(), action.toValue.constData(), v), QDeclarativeMetaProperty::BypassInterceptor | QDeclarativeMetaProperty::DontRemoveBinding); + QDeclarativeMetaPropertyPrivate::write(action.property, interpolator(action.fromValue.constData(), action.toValue.constData(), v), QDeclarativeMetaPropertyPrivate::BypassInterceptor | QDeclarativeMetaPropertyPrivate::DontRemoveBinding); } if (deleted) return; diff --git a/src/declarative/util/qdeclarativebehavior.cpp b/src/declarative/util/qdeclarativebehavior.cpp index 303018d..b1f1677 100644 --- a/src/declarative/util/qdeclarativebehavior.cpp +++ b/src/declarative/util/qdeclarativebehavior.cpp @@ -46,6 +46,7 @@ #include #include +#include #include @@ -156,7 +157,7 @@ void QDeclarativeBehavior::write(const QVariant &value) { Q_D(QDeclarativeBehavior); if (!d->animation || !d->enabled) { - d->property.write(value, QDeclarativeMetaProperty::BypassInterceptor | QDeclarativeMetaProperty::DontRemoveBinding); + QDeclarativeMetaPropertyPrivate::write(d->property, value, QDeclarativeMetaPropertyPrivate::BypassInterceptor | QDeclarativeMetaPropertyPrivate::DontRemoveBinding); return; } @@ -176,7 +177,7 @@ void QDeclarativeBehavior::write(const QVariant &value) d->animation->transition(actions, after, QDeclarativeAbstractAnimation::Forward); d->animation->qtAnimation()->start(); if (!after.contains(d->property)) - d->property.write(value, QDeclarativeMetaProperty::BypassInterceptor | QDeclarativeMetaProperty::DontRemoveBinding); + QDeclarativeMetaPropertyPrivate::write(d->property, value, QDeclarativeMetaPropertyPrivate::BypassInterceptor | QDeclarativeMetaPropertyPrivate::DontRemoveBinding); } void QDeclarativeBehavior::setTarget(const QDeclarativeMetaProperty &property) diff --git a/src/declarative/util/qdeclarativetransitionmanager.cpp b/src/declarative/util/qdeclarativetransitionmanager.cpp index 9fa1488..6429dab 100644 --- a/src/declarative/util/qdeclarativetransitionmanager.cpp +++ b/src/declarative/util/qdeclarativetransitionmanager.cpp @@ -45,6 +45,7 @@ #include #include +#include QT_BEGIN_NAMESPACE @@ -149,9 +150,9 @@ void QDeclarativeTransitionManager::transition(const QList & for (int ii = 0; ii < applyList.size(); ++ii) { const QDeclarativeAction &action = applyList.at(ii); if (action.toBinding) { - QDeclarativeMetaPropertyPrivate::setBinding(action.property, action.toBinding, QDeclarativeMetaProperty::BypassInterceptor | QDeclarativeMetaProperty::DontRemoveBinding); + QDeclarativeMetaPropertyPrivate::setBinding(action.property, action.toBinding, QDeclarativeMetaPropertyPrivate::BypassInterceptor | QDeclarativeMetaPropertyPrivate::DontRemoveBinding); } else if (!action.event) { - action.property.write(action.toValue, QDeclarativeMetaProperty::BypassInterceptor | QDeclarativeMetaProperty::DontRemoveBinding); + QDeclarativeMetaPropertyPrivate::write(action.property, action.toValue, QDeclarativeMetaPropertyPrivate::BypassInterceptor | QDeclarativeMetaPropertyPrivate::DontRemoveBinding); } else if (action.event->isReversable()) { if (action.reverseEvent) action.event->reverse(); @@ -192,7 +193,7 @@ void QDeclarativeTransitionManager::transition(const QList & if (action.toBinding) QDeclarativeMetaPropertyPrivate::setBinding(action.property, 0); // Make sure this is disabled during the transition - action.property.write(action.fromValue, QDeclarativeMetaProperty::BypassInterceptor | QDeclarativeMetaProperty::DontRemoveBinding); + QDeclarativeMetaPropertyPrivate::write(action.property, action.fromValue, QDeclarativeMetaPropertyPrivate::BypassInterceptor | QDeclarativeMetaPropertyPrivate::DontRemoveBinding); } } diff --git a/tests/auto/declarative/qdeclarativemetaproperty/tst_qdeclarativemetaproperty.cpp b/tests/auto/declarative/qdeclarativemetaproperty/tst_qdeclarativemetaproperty.cpp index 4d07a19..a7e9d0d 100644 --- a/tests/auto/declarative/qdeclarativemetaproperty/tst_qdeclarativemetaproperty.cpp +++ b/tests/auto/declarative/qdeclarativemetaproperty/tst_qdeclarativemetaproperty.cpp @@ -168,7 +168,7 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty() QVERIFY(QDeclarativeMetaPropertyPrivate::setSignalExpression(prop, expression) == 0); QVERIFY(expression == 0); QCOMPARE(prop.coreIndex(), -1); - QCOMPARE(prop.valueTypeCoreIndex(), -1); + QCOMPARE(QDeclarativeMetaPropertyPrivate::valueTypeCoreIndex(prop), -1); delete obj; } @@ -256,7 +256,7 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object() QVERIFY(QDeclarativeMetaPropertyPrivate::setSignalExpression(prop, expression) == 0); QVERIFY(expression == 0); QCOMPARE(prop.coreIndex(), -1); - QCOMPARE(prop.valueTypeCoreIndex(), -1); + QCOMPARE(QDeclarativeMetaPropertyPrivate::valueTypeCoreIndex(prop), -1); delete obj; } @@ -305,7 +305,7 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object() QVERIFY(QDeclarativeMetaPropertyPrivate::setSignalExpression(prop, expression) == 0); QVERIFY(expression == 0); QCOMPARE(prop.coreIndex(), dobject.metaObject()->indexOfProperty("defaultProperty")); - QCOMPARE(prop.valueTypeCoreIndex(), -1); + QCOMPARE(QDeclarativeMetaPropertyPrivate::valueTypeCoreIndex(prop), -1); delete obj; } @@ -357,7 +357,7 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object_string() QVERIFY(QDeclarativeMetaPropertyPrivate::setSignalExpression(prop, expression) == 0); QVERIFY(expression == 0); QCOMPARE(prop.coreIndex(), -1); - QCOMPARE(prop.valueTypeCoreIndex(), -1); + QCOMPARE(QDeclarativeMetaPropertyPrivate::valueTypeCoreIndex(prop), -1); delete obj; } @@ -406,7 +406,7 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object_string() QVERIFY(QDeclarativeMetaPropertyPrivate::setSignalExpression(prop, expression) == 0); QVERIFY(expression == 0); QCOMPARE(prop.coreIndex(), dobject.metaObject()->indexOfProperty("defaultProperty")); - QCOMPARE(prop.valueTypeCoreIndex(), -1); + QCOMPARE(QDeclarativeMetaPropertyPrivate::valueTypeCoreIndex(prop), -1); delete obj; } @@ -454,7 +454,7 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object_string() QVERIFY(expression != 0); QVERIFY(QDeclarativeMetaPropertyPrivate::signalExpression(prop) == expression); QCOMPARE(prop.coreIndex(), dobject.metaObject()->indexOfMethod("clicked()")); - QCOMPARE(prop.valueTypeCoreIndex(), -1); + QCOMPARE(QDeclarativeMetaPropertyPrivate::valueTypeCoreIndex(prop), -1); delete obj; } @@ -506,7 +506,7 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object_context() QVERIFY(QDeclarativeMetaPropertyPrivate::setSignalExpression(prop, expression) == 0); QVERIFY(expression == 0); QCOMPARE(prop.coreIndex(), -1); - QCOMPARE(prop.valueTypeCoreIndex(), -1); + QCOMPARE(QDeclarativeMetaPropertyPrivate::valueTypeCoreIndex(prop), -1); delete obj; } @@ -555,7 +555,7 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object_context() QVERIFY(QDeclarativeMetaPropertyPrivate::setSignalExpression(prop, expression) == 0); QVERIFY(expression == 0); QCOMPARE(prop.coreIndex(), dobject.metaObject()->indexOfProperty("defaultProperty")); - QCOMPARE(prop.valueTypeCoreIndex(), -1); + QCOMPARE(QDeclarativeMetaPropertyPrivate::valueTypeCoreIndex(prop), -1); delete obj; } @@ -607,7 +607,7 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object_string_context() QVERIFY(QDeclarativeMetaPropertyPrivate::setSignalExpression(prop, expression) == 0); QVERIFY(expression == 0); QCOMPARE(prop.coreIndex(), -1); - QCOMPARE(prop.valueTypeCoreIndex(), -1); + QCOMPARE(QDeclarativeMetaPropertyPrivate::valueTypeCoreIndex(prop), -1); delete obj; } @@ -656,7 +656,7 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object_string_context() QVERIFY(QDeclarativeMetaPropertyPrivate::setSignalExpression(prop, expression) == 0); QVERIFY(expression == 0); QCOMPARE(prop.coreIndex(), dobject.metaObject()->indexOfProperty("defaultProperty")); - QCOMPARE(prop.valueTypeCoreIndex(), -1); + QCOMPARE(QDeclarativeMetaPropertyPrivate::valueTypeCoreIndex(prop), -1); delete obj; } @@ -704,7 +704,7 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object_string_context() QVERIFY(expression != 0); QVERIFY(QDeclarativeMetaPropertyPrivate::signalExpression(prop) == expression); QCOMPARE(prop.coreIndex(), dobject.metaObject()->indexOfMethod("clicked()")); - QCOMPARE(prop.valueTypeCoreIndex(), -1); + QCOMPARE(QDeclarativeMetaPropertyPrivate::valueTypeCoreIndex(prop), -1); delete obj; } diff --git a/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h b/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h index 8b80e16..82a9c8a 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h +++ b/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h @@ -53,6 +53,7 @@ #include #include #include +#include class MyTypeObject : public QObject { @@ -143,7 +144,7 @@ class MyOffsetValueInterceptor : public QObject, public QDeclarativePropertyValu Q_OBJECT public: virtual void setTarget(const QDeclarativeMetaProperty &p) { prop = p; } - virtual void write(const QVariant &value) { prop.write(value.toInt() + 13, QDeclarativeMetaProperty::BypassInterceptor); } + virtual void write(const QVariant &value) { QDeclarativeMetaPropertyPrivate::write(prop, value.toInt() + 13, QDeclarativeMetaPropertyPrivate::BypassInterceptor); } private: QDeclarativeMetaProperty prop; -- cgit v0.12