Commit 5ac29906 authored by Aaron Kennedy's avatar Aaron Kennedy Committed by Qt by Nokia

Introduce more generic fast property handling

Also reduce the number of direct calls to qt_metacall().

Change-Id: I04cd6e516a3e61058548309a19fe0b830f15c93f
Reviewed-by: default avatarRoberto Raggi <roberto.raggi@nokia.com>
parent 5c9179b1
......@@ -39,71 +39,89 @@
**
****************************************************************************/
#include "qdeclarativefastproperties_p.h"
#include "qdeclarativeaccessors_p.h"
#include "qdeclarativedata_p.h"
#include "qdeclarativenotifier_p.h"
QT_BEGIN_NAMESPACE
// Adding entries to the QDeclarativeFastProperties class allows the QML
// binding optimizer to bypass Qt's meta system and read and, more
// importantly, subscribe to properties directly. Any property that is
// primarily read from bindings is a candidate for inclusion as a fast
// property.
struct AccessorProperties {
AccessorProperties();
Q_GLOBAL_STATIC(QDeclarativeFastProperties, fastProperties)
QReadWriteLock lock;
QHash<const QMetaObject *, QDeclarativeAccessorProperties::Properties> properties;
};
QDeclarativeFastProperties *QDeclarativeFastProperties::instance()
Q_GLOBAL_STATIC(AccessorProperties, accessorProperties)
QML_PRIVATE_ACCESSOR(QObject, QString, objectName, objectName)
static void QObject_objectNameNotifier(QObject *object, intptr_t, QDeclarativeNotifier **notifier)
{
*notifier = QDeclarativeData::get(object, true)->objectNameNotifier();
}
static QDeclarativeAccessors QObject_objectName = { QObject_objectNameRead,
QObject_objectNameNotifier };
QML_DECLARE_PROPERTIES(QObject) {
{ QML_PROPERTY_NAME(objectName), 0, &QObject_objectName }
};
static void buildNameMask(QDeclarativeAccessorProperties::Properties &properties)
{
return fastProperties();
quint32 mask = 0;
for (int ii = 0; ii < properties.count; ++ii) {
Q_ASSERT(strlen(properties.properties[ii].name) == properties.properties[ii].nameLength);
Q_ASSERT(properties.properties[ii].nameLength > 0);
mask |= (1 << qMin(31U, properties.properties[ii].nameLength - 1));
}
properties.nameMask = mask;
}
static void QObject_objectName(QObject *object, void *output, QDeclarativeNotifierEndpoint *endpoint)
AccessorProperties::AccessorProperties()
{
if (endpoint)
endpoint->connect(QDeclarativeData::get(object, true)->objectNameNotifier());
*((QString *)output) = object->objectName();
// Pre-seed QObject::objectName accessor
typedef QDeclarativeAccessorProperties::Properties P;
properties.insert(&QObject::staticMetaObject,
P(qdeclarative_accessor_properties_QObject,
sizeof(qdeclarative_accessor_properties_QObject) /
sizeof(QDeclarativeAccessorProperties::Property)));
}
QDeclarativeFastProperties::QDeclarativeFastProperties()
QDeclarativeAccessorProperties::Properties::Properties(Property *properties, int count)
: count(count), properties(properties)
{
add(&QObject::staticMetaObject, QObject::staticMetaObject.indexOfProperty("objectName"),
QObject_objectName);
buildNameMask(*this);
}
int QDeclarativeFastProperties::accessorIndexForProperty(const QMetaObject *metaObject, int propertyIndex)
QDeclarativeAccessorProperties::Properties
QDeclarativeAccessorProperties::properties(const QMetaObject *mo)
{
Q_ASSERT(metaObject);
Q_ASSERT(propertyIndex >= 0);
// Find the "real" metaObject
while (metaObject->propertyOffset() > propertyIndex)
metaObject = metaObject->superClass();
QReadLocker lock(&m_lock);
QHash<QPair<const QMetaObject *, int>, int>::Iterator iter =
m_index.find(qMakePair(metaObject, propertyIndex));
if (iter != m_index.end())
return *iter;
else
return -1;
AccessorProperties *This = accessorProperties();
QReadLocker lock(&This->lock);
return This->properties.value(mo);
}
void QDeclarativeFastProperties::add(const QMetaObject *metaObject, int propertyIndex, Accessor accessor)
void QDeclarativeAccessorProperties::registerProperties(const QMetaObject *mo, int count,
Property *props)
{
Q_ASSERT(metaObject);
Q_ASSERT(propertyIndex >= 0);
// Find the "real" metaObject
while (metaObject->propertyOffset() > propertyIndex)
metaObject = metaObject->superClass();
QPair<const QMetaObject *, int> data = qMakePair(metaObject, propertyIndex);
QWriteLocker lock(&m_lock);
int accessorIndex = m_accessors.count();
m_accessors.append(accessor);
m_index.insert(data, accessorIndex);
Q_ASSERT(count > 0);
Properties properties(props, count);
AccessorProperties *This = accessorProperties();
QWriteLocker lock(&This->lock);
Q_ASSERT(!This->properties.contains(mo) || This->properties.value(mo) == properties);
This->properties.insert(mo, properties);
}
QT_END_NAMESPACE
......@@ -39,8 +39,8 @@
**
****************************************************************************/
#ifndef QDECLARATIVEFASTPROPERTIES_P_H
#define QDECLARATIVEFASTPROPERTIES_P_H
#ifndef QDECLARATIVEACCESSORS_P_H
#define QDECLARATIVEACCESSORS_P_H
#include <QtCore/qvector.h>
#include <QtCore/qhash.h>
......@@ -51,28 +51,114 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
class QObject;
class QDeclarativeNotifierEndpoint;
class Q_DECLARATIVE_EXPORT QDeclarativeFastProperties
class QDeclarativeNotifier;
// QML "accessor properties" allow V4 and V8 to bypass Qt's meta system to read and, more
// importantly, subscribe to properties directly. Any property that is primarily read
// from bindings is a candidate for inclusion as an accessor property.
//
// To define accessor properties, use the QML_DECLARE_PROPERTIES() and QML_DEFINE_PROPERTIES()
// macros. The QML_DECLARE_PROPERTIES() macro is used to specify the properties, and the
// QML_DEFINE_PROPERTIES() macro to register the properties with the
// QDeclarativeAccessorProperties singleton.
//
// A class with accessor properties must also add the Q_CLASSINFO("qt_HasQmlAccessors", "true")
// tag to its declaration. This is essential for QML to maintain internal consistency,
// and forgetting to do so will probably cause your application to qFatal() with a
// helpful reminder of this requirement.
//
// It is important that QML_DEFINE_PROPERTIES() has been called before QML ever sees
// the type with the accessor properties. As QML_DEFINE_PROPERTIES() is idempotent, it is
// recommended to call it in the type's constructor as well as when the type is registered
// as a QML element (if it ever is). QML_DEFINE_PROPERTIES() is a very cheap operation
// if registration has already occurred.
#define QML_DECLARE_PROPERTIES(type) \
static volatile bool qdeclarative_accessor_properties_isregistered_ ## type = false; \
static QDeclarativeAccessorProperties::Property qdeclarative_accessor_properties_ ## type[] =
#define QML_DEFINE_PROPERTIES(type) \
do { \
if (!qdeclarative_accessor_properties_isregistered_ ## type) { \
int count = sizeof(qdeclarative_accessor_properties_ ## type) / \
sizeof(QDeclarativeAccessorProperties::Property); \
QDeclarativeAccessorProperties::registerProperties(&type::staticMetaObject, count, \
qdeclarative_accessor_properties_ ## type);\
qdeclarative_accessor_properties_isregistered_ ## type = true; \
} \
} while (false);
#define QML_PRIVATE_ACCESSOR(clazz, cpptype, name, variable) \
static void clazz ## _ ## name ## Read(QObject *o, intptr_t, void *rv) \
{ \
clazz ## Private *d = clazz ## Private::get(static_cast<clazz *>(o)); \
*static_cast<cpptype *>(rv) = d->variable; \
}
#define QML_PROPERTY_NAME(name) #name, sizeof #name - 1
struct QDeclarativeAccessors
{
public:
typedef void (*Accessor)(QObject *object, void *output, QDeclarativeNotifierEndpoint *endpoint);
QDeclarativeFastProperties();
void (*read)(QObject *object, intptr_t property, void *output);
void (*notifier)(QObject *object, intptr_t property, QDeclarativeNotifier **notifier);
};
namespace QDeclarativeAccessorProperties {
struct Property {
const char *name;
unsigned int nameLength;
intptr_t data;
QDeclarativeAccessors *accessors;
};
Accessor accessor(int index) const { QReadLocker lock(&m_lock); return m_accessors.at(index); }
int accessorIndexForProperty(const QMetaObject *, int);
struct Properties {
inline Properties();
Properties(Property *, int);
void add(const QMetaObject *, int, Accessor);
bool operator==(const Properties &o) const {
return count == o.count && properties == o.properties;
}
static QDeclarativeFastProperties *instance();
inline Property *property(const char *name);
private:
QHash<QPair<const QMetaObject *, int>, int> m_index;
QVector<Accessor> m_accessors;
mutable QReadWriteLock m_lock;
int count;
Property *properties;
quint32 nameMask;
};
Properties properties(const QMetaObject *);
void Q_DECLARATIVE_EXPORT registerProperties(const QMetaObject *, int, Property *);
};
QDeclarativeAccessorProperties::Property *
QDeclarativeAccessorProperties::Properties::property(const char *name)
{
if (count == 0)
return 0;
unsigned int length = strlen(name);
Q_ASSERT(length);
if (nameMask & (1 << qMin(31U, length - 1))) {
for (int ii = 0; ii < count; ++ii) {
if (properties[ii].nameLength == length && 0 == qstrcmp(name, properties[ii].name))
return &properties[ii];
}
}
return 0;
}
QDeclarativeAccessorProperties::Properties::Properties()
: count(0), properties(0), nameMask(0)
{
}
QT_END_NAMESPACE
QT_END_HEADER
#endif // QDECLARATIVEFASTPROPERTIES_P_H
#endif // QDECLARATIVEACCESSORS_P_H
......@@ -300,6 +300,16 @@ void QDeclarativeBinding::setTarget(const QDeclarativeProperty &prop)
update();
}
void QDeclarativeBinding::setTarget(QObject *object,
const QDeclarativePropertyData &core,
QDeclarativeContextData *ctxt)
{
Q_D(QDeclarativeBinding);
d->property = QDeclarativePropertyPrivate::restore(object, core, ctxt);
update();
}
QDeclarativeProperty QDeclarativeBinding::property() const
{
Q_D(const QDeclarativeBinding);
......
......@@ -157,6 +157,7 @@ public:
QDeclarativeBinding(void *, QObject *, QDeclarativeContextData *, QObject *parent=0);
void setTarget(const QDeclarativeProperty &);
void setTarget(QObject *, const QDeclarativePropertyData &, QDeclarativeContextData *);
QDeclarativeProperty property() const;
void setEvaluateFlags(EvaluateFlags flags);
......
......@@ -219,6 +219,11 @@ QDeclarativeProperty::QDeclarativeProperty(QObject *obj, const QString &name, QD
Q_GLOBAL_STATIC(QDeclarativeValueTypeFactory, qmlValueTypes);
QDeclarativePropertyPrivate::QDeclarativePropertyPrivate()
: context(0), engine(0), object(0), isNameCached(false)
{
}
QDeclarativeContextData *QDeclarativePropertyPrivate::effectiveContext() const
{
if (context) return context;
......@@ -1695,8 +1700,8 @@ QDeclarativePropertyPrivate::saveValueType(const QMetaObject *metaObject, int in
}
QDeclarativeProperty
QDeclarativePropertyPrivate::restore(const QDeclarativePropertyData &data,
QObject *object, QDeclarativeContextData *ctxt)
QDeclarativePropertyPrivate::restore(QObject *object, const QDeclarativePropertyData &data,
QDeclarativeContextData *ctxt)
{
QDeclarativeProperty prop;
......
......@@ -69,21 +69,26 @@ class QDeclarativeJavaScriptExpression;
class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativePropertyPrivate : public QDeclarativeRefCount
{
public:
enum WriteFlag { BypassInterceptor = 0x01, DontRemoveBinding = 0x02, RemoveBindingOnAliasWrite = 0x04 };
enum WriteFlag {
BypassInterceptor = 0x01,
DontRemoveBinding = 0x02,
RemoveBindingOnAliasWrite = 0x04
};
Q_DECLARE_FLAGS(WriteFlags, WriteFlag)
QDeclarativePropertyPrivate()
: context(0), engine(0), object(0), isNameCached(false) {}
inline QDeclarativeContextData *effectiveContext() const;
QDeclarativeContextData *context;
QDeclarativeEngine *engine;
QDeclarativeGuard<QObject> object;
bool isNameCached:1;
QDeclarativePropertyData core;
bool isNameCached:1;
QString nameCache;
QDeclarativePropertyPrivate();
inline QDeclarativeContextData *effectiveContext() const;
void initProperty(QObject *obj, const QString &name);
void initDefault(QObject *obj);
......@@ -105,18 +110,21 @@ public:
static bool write(QObject *, const QDeclarativePropertyData &, const QVariant &,
QDeclarativeContextData *, WriteFlags flags = 0);
static void findAliasTarget(QObject *, int, QObject **, int *);
static QDeclarativeAbstractBinding *setBinding(QObject *, int coreIndex, int valueTypeIndex /* -1 */,
static QDeclarativeAbstractBinding *setBinding(QObject *, int coreIndex,
int valueTypeIndex /* -1 */,
QDeclarativeAbstractBinding *,
WriteFlags flags = DontRemoveBinding);
static QDeclarativeAbstractBinding *setBindingNoEnable(QObject *, int coreIndex, int valueTypeIndex /* -1 */,
static QDeclarativeAbstractBinding *setBindingNoEnable(QObject *, int coreIndex,
int valueTypeIndex /* -1 */,
QDeclarativeAbstractBinding *);
static QDeclarativeAbstractBinding *binding(QObject *, int coreIndex, int valueTypeIndex /* -1 */);
static QDeclarativeAbstractBinding *binding(QObject *, int coreIndex,
int valueTypeIndex /* -1 */);
static QDeclarativePropertyData saveValueType(const QMetaObject *, int,
const QMetaObject *, int,
QDeclarativeEngine *);
static QDeclarativeProperty restore(const QDeclarativePropertyData &,
QObject *,
static QDeclarativeProperty restore(QObject *,
const QDeclarativePropertyData &,
QDeclarativeContextData *);
static bool equal(const QMetaObject *, const QMetaObject *);
......
......@@ -63,14 +63,15 @@
QT_BEGIN_NAMESPACE
class QDeclarativeEngine;
class QMetaProperty;
class QV8Engine;
class QMetaProperty;
class QV8QObjectWrapper;
class QDeclarativePropertyCacheMethodArguments;
class QDeclarativeEngine;
class QDeclarativePropertyData;
class QDeclarativeAccessors;
class QDeclarativePropertyCacheMethodArguments;
// We have this somewhat aweful split between RawData and Data so that RawData can be
// We have this somewhat awful split between RawData and Data so that RawData can be
// used in unions. In normal code, you should always use Data which initializes RawData
// to an invalid state on construction.
class QDeclarativePropertyRawData
......@@ -87,29 +88,31 @@ public:
IsAlias = 0x00000008, // Is a QML alias to another property
IsFinal = 0x00000010, // Has FINAL flag
IsDirect = 0x00000020, // Exists on a C++ QMetaObject
HasAccessors = 0x00000040, // Has property accessors
// These are mutualy exclusive
IsFunction = 0x00000040, // Is an invokable
IsQObjectDerived = 0x00000080, // Property type is a QObject* derived type
IsEnumType = 0x00000100, // Property type is an enum
IsQList = 0x00000200, // Property type is a QML list
IsQmlBinding = 0x00000400, // Property type is a QDeclarativeBinding*
IsQJSValue = 0x00000800, // Property type is a QScriptValue
IsV8Handle = 0x00001000, // Property type is a QDeclarativeV8Handle
IsVMEProperty = 0x00002000, // Property type is a "var" property of VMEMO
IsValueTypeVirtual = 0x00004000, // Property is a value type "virtual" property
IsFunction = 0x00000080, // Is an invokable
IsQObjectDerived = 0x00000100, // Property type is a QObject* derived type
IsEnumType = 0x00000200, // Property type is an enum
IsQList = 0x00000400, // Property type is a QML list
IsQmlBinding = 0x00000800, // Property type is a QDeclarativeBinding*
IsQJSValue = 0x00001000, // Property type is a QScriptValue
IsV8Handle = 0x00002000, // Property type is a QDeclarativeV8Handle
IsVMEProperty = 0x00004000, // Property type is a "var" property of VMEMO
IsValueTypeVirtual = 0x00008000, // Property is a value type "virtual" property
IsQVariant = 0x00010000, // Property is a QVariant
// Apply only to IsFunctions
IsVMEFunction = 0x00008000, // Function was added by QML
HasArguments = 0x00010000, // Function takes arguments
IsSignal = 0x00020000, // Function is a signal
IsVMESignal = 0x00040000, // Signal was added by QML
IsV8Function = 0x00080000, // Function takes QDeclarativeV8Function* args
IsSignalHandler = 0x00100000, // Function is a signal handler
IsOverload = 0x00200000, // Function is an overload of another function
IsVMEFunction = 0x00020000, // Function was added by QML
HasArguments = 0x00040000, // Function takes arguments
IsSignal = 0x00080000, // Function is a signal
IsVMESignal = 0x00100000, // Signal was added by QML
IsV8Function = 0x00200000, // Function takes QDeclarativeV8Function* args
IsSignalHandler = 0x00400000, // Function is a signal handler
IsOverload = 0x00800000, // Function is an overload of another function
// Internal QDeclarativePropertyCache flags
NotFullyResolved = 0x00400000 // True if the type data is to be lazily resolved
NotFullyResolved = 0x01000000 // True if the type data is to be lazily resolved
};
Q_DECLARE_FLAGS(Flags, Flag)
......@@ -124,6 +127,7 @@ public:
bool isAlias() const { return flags & IsAlias; }
bool isFinal() const { return flags & IsFinal; }
bool isDirect() const { return flags & IsDirect; }
bool hasAccessors() const { return flags & HasAccessors; }
bool isFunction() const { return flags & IsFunction; }
bool isQObject() const { return flags & IsQObjectDerived; }
bool isEnum() const { return flags & IsEnumType; }
......@@ -133,6 +137,7 @@ public:
bool isV8Handle() const { return flags & IsV8Handle; }
bool isVMEProperty() const { return flags & IsVMEProperty; }
bool isValueTypeVirtual() const { return flags & IsValueTypeVirtual; }
bool isQVariant() const { return flags & IsQVariant; }
bool isVMEFunction() const { return flags & IsVMEFunction; }
bool hasArguments() const { return flags & HasArguments; }
bool isSignal() const { return flags & IsSignal; }
......@@ -141,6 +146,11 @@ public:
bool isSignalHandler() const { return flags & IsSignalHandler; }
bool isOverload() const { return flags & IsOverload; }
bool hasOverride() const { return !(flags & IsValueTypeVirtual) && overrideIndex >= 0; }
// Returns -1 if not a value type virtual property
inline int getValueTypeCoreIndex() const;
union {
int propType; // When !NotFullyResolved
const char *propTypeName; // When NotFullyResolved
......@@ -163,8 +173,14 @@ public:
//proxy object
};
};
int revision;
int metaObjectOffset;
qint16 revision;
qint16 metaObjectOffset;
struct { // When HasAccessors
QDeclarativeAccessors *accessors;
intptr_t accessorData;
};
private:
friend class QDeclarativePropertyData;
......@@ -187,9 +203,6 @@ public:
QString name(QObject *);
QString name(const QMetaObject *);
// Returns -1 if not a value type virtual property
inline int getValueTypeCoreIndex() const;
private:
friend class QDeclarativePropertyCache;
void lazyLoad(const QMetaProperty &, QDeclarativeEngine *engine = 0);
......@@ -216,8 +229,6 @@ public:
QDeclarativePropertyData::Flag methodFlags = QDeclarativePropertyData::NoFlags,
QDeclarativePropertyData::Flag signalFlags = QDeclarativePropertyData::NoFlags);
static QDeclarativePropertyData create(const QMetaObject *, const QString &);
inline QDeclarativePropertyData *property(const QHashedV8String &) const;
QDeclarativePropertyData *property(const QHashedStringRef &) const;
QDeclarativePropertyData *property(const QHashedCStringRef &) const;
......@@ -282,6 +293,8 @@ QDeclarativePropertyData::QDeclarativePropertyData()
overrideIndex = -1;
revision = 0;
metaObjectOffset = -1;
accessors = 0;
accessorData = 0;
flags = 0;
}
......@@ -302,7 +315,7 @@ bool QDeclarativePropertyData::operator==(const QDeclarativePropertyRawData &oth
valueTypePropType == other.valueTypePropType));
}
int QDeclarativePropertyData::getValueTypeCoreIndex() const
int QDeclarativePropertyRawData::getValueTypeCoreIndex() const
{
return isValueTypeVirtual()?valueTypeCoreIndex:-1;
}
......@@ -310,7 +323,7 @@ int QDeclarativePropertyData::getValueTypeCoreIndex() const
QDeclarativePropertyData *
QDeclarativePropertyCache::overrideData(QDeclarativePropertyData *data) const
{
if (data->overrideIndex < 0)
if (!data->hasOverride())
return 0;
if (data->overrideIndexIsProperty)
......
......@@ -79,10 +79,12 @@ public:
virtual void read(QObject *, int) = 0;
virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags flags) = 0;
virtual QVariant value() = 0;
virtual void setValue(QVariant) = 0;
virtual void setValue(const QVariant &) = 0;
virtual QString toString() const = 0;
virtual bool isEqual(const QVariant &value) const = 0;
inline void onLoad();
};
class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeValueTypeFactory
......@@ -117,7 +119,7 @@ public:
virtual void read(QObject *, int);
virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags);
virtual QVariant value();
virtual void setValue(QVariant value);
virtual void setValue(const QVariant &value);
virtual QString toString() const;
virtual bool isEqual(const QVariant &value) const;
......@@ -142,7 +144,7 @@ public:
virtual void read(QObject *, int);
virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags);
virtual QVariant value();
virtual void setValue(QVariant value);
virtual void setValue(const QVariant &value);
virtual QString toString() const;
virtual bool isEqual(const QVariant &value) const;
......@@ -167,7 +169,7 @@ public:
virtual void read(QObject *, int);
virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags);
virtual QVariant value();
virtual void setValue(QVariant value);
virtual void setValue(const QVariant &value);
virtual QString toString() const;
virtual bool isEqual(const QVariant &value) const;
......@@ -192,7 +194,7 @@ public:
virtual void read(QObject *, int);
virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags);
virtual QVariant value();
virtual void setValue(QVariant value);
virtual void setValue(const QVariant &value);
virtual QString toString() const;
virtual bool isEqual(const QVariant &value) const;
......@@ -219,7 +221,7 @@ public:
virtual void read(QObject *, int);
virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags);
virtual QVariant value();
virtual void setValue(QVariant value);
virtual void setValue(const QVariant &value);
virtual QString toString() const;
virtual bool isEqual(const QVariant &value) const;
......@@ -251,7 +253,7 @@ public:
virtual void read(QObject *, int);
virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags);
virtual QVariant value();
virtual void setValue(QVariant value);
virtual void setValue(const QVariant &value);
virtual QString toString() const;
virtual bool isEqual(const QVariant &value) const;
......@@ -280,7 +282,7 @@ public:
virtual void read(QObject *, int);
virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags);
virtual QVariant value();
virtual void setValue(QVariant value);
virtual void setValue(const QVariant &value);
virtual QString toString() const;
virtual bool isEqual(const QVariant &value) const;
......@@ -305,7 +307,7 @@ public:
virtual void read(QObject *, int);
virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags);
virtual QVariant value();
virtual void setValue(QVariant value);
virtual void setValue(const QVariant &value);
virtual QString toString() const;
virtual bool isEqual(const QVariant &value) const;
......@@ -333,7 +335,7 @@ public:
virtual void read(QObject *, int);
virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags);
virtual QVariant value();
virtual void setValue(QVariant value);
virtual void setValue(const QVariant &value);
virtual QString toString() const;
virtual bool isEqual(const QVariant &value) const;
......@@ -363,7 +365,7 @@ public:
virtual void read(QObject *, int);
virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags);
virtual QVariant value();
virtual void setValue(QVariant value);
virtual void setValue(const QVariant &value);
virtual QString toString() const;
virtual bool isEqual(const QVariant &value) const;
......@@ -405,7 +407,7 @@ public:
virtual void read(QObject *, int);
virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags);
virtual QVariant value();
virtual void setValue(QVariant value);
virtual void setValue(const QVariant &value);
virtual QString toString() const;
virtual bool isEqual(const QVariant &value) const;
......@@ -490,7 +492,7 @@ public:
virtual void read(QObject *, int);
virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags);
virtual QVariant value();
virtual void setValue(QVariant value);
virtual void setValue(const QVariant &value);
virtual QString toString() const;
virtual bool isEqual(const QVariant &value) const;
......@@ -546,7 +548,7 @@ public:
virtual void read(QObject *, int);
virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags);
virtual QVariant value();
virtual void setValue(QVariant value);
virtual void setValue(const QVariant &value);
virtual QString toString() const;
virtual bool isEqual(const QVariant &value) const;
......@@ -586,6 +588,7 @@ public:
qreal wordSpacing() const;
void setWordSpacing(qreal spacing);
void onLoad();
private:
QFont font;
bool pixelSizeSet;
......@@ -606,7 +609,7 @@ public:
virtual void read(QObject *, int);
virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags);
virtual QVariant value();
virtual void setValue(QVariant value);
virtual void setValue(const QVariant &value);
virtual QString toString() const;
virtual bool isEqual(const QVariant &value) const;
......@@ -623,6 +626,10 @@ private:
QColor color;
};
void QDeclarativeValueType::onLoad()
{
}
QT_END_NAMESPACE
#endif // QDECLARATIVEVALUETYPE_P_H
This diff is collapsed.
......@@ -29,7 +29,7 @@ SOURCES += \