class QQmlAccessors;
class QMetaObjectBuilder;
class QQmlPropertyCacheMethodArguments;
+class QQmlVMEMetaObject;
// 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
inline int getValueTypeCoreIndex() const;
// Returns the "encoded" index for use with bindings. Encoding is:
- // coreIndex | (valueTypeCoreIndex << 24)
+ // coreIndex | (valueTypeCoreIndex << 16)
inline int encodedIndex() const;
union {
struct { // When IsValueTypeVirtual
quint16 valueTypeFlags; // flags of the access property on the value type proxy
// object
- quint8 valueTypePropType; // The QVariant::Type of access property on the value
- // type proxy object
- quint8 valueTypeCoreIndex; // The prop index of the access property on the value
+ quint16 valueTypePropType; // The QVariant::Type of access property on the value
// type proxy object
+ quint16 valueTypeCoreIndex; // The prop index of the access property on the value
+ // type proxy object
};
struct { // When !IsValueTypeVirtual
QString name(QObject *);
QString name(const QMetaObject *);
+ void markAsOverrideOf(QQmlPropertyData *predecessor);
+
private:
friend class QQmlPropertyCache;
void lazyLoad(const QMetaProperty &, QQmlEngine *engine = 0);
const QMetaObject *createMetaObject();
const QMetaObject *firstCppMetaObject() const;
- inline QQmlPropertyData *property(const QHashedV8String &) const;
- QQmlPropertyData *property(const QHashedStringRef &) const;
- QQmlPropertyData *property(const QHashedCStringRef &) const;
- QQmlPropertyData *property(const QString &) const;
+ template<typename K>
+ QQmlPropertyData *property(const K &key, QObject *object, QQmlContextData *context) const
+ {
+ return findProperty(stringCache.find(key), object, context);
+ }
+
QQmlPropertyData *property(int) const;
QQmlPropertyData *method(int) const;
- QQmlPropertyData *signal(int) const;
+ QQmlPropertyData *signal(int index) const { return signal(index, 0); }
int methodIndexToSignalIndex(int) const;
QStringList propertyNames() const;
inline QQmlEngine *qmlEngine() const;
static QQmlPropertyData *property(QQmlEngine *, QObject *, const QString &,
- QQmlPropertyData &);
+ QQmlContextData *, QQmlPropertyData &);
static QQmlPropertyData *property(QQmlEngine *, QObject *, const QHashedV8String &,
- QQmlPropertyData &);
+ QQmlContextData *, QQmlPropertyData &);
static int *methodParameterTypes(QObject *, int index, QVarLengthArray<int, 9> &dummy,
QByteArray *unknownTypeError);
static int methodReturnType(QObject *, const QQmlPropertyData &data,
QByteArray *unknownTypeError);
- static QList<QByteArray> signalParameterNames(QObject *, int index);
+
+ //see QMetaObjectPrivate::originalClone
+ int originalClone(int index);
+ static int originalClone(QObject *, int index);
+
+ QList<QByteArray> signalParameterNames(int index) const;
+ QString signalParameterStringForJS(int index, int *count = 0, QString *errorString = 0);
const char *className() const;
// Implemented in v8/qv8qobjectwrapper.cpp
v8::Local<v8::Object> newQObject(QObject *, QV8Engine *);
+ QQmlPropertyData *signal(int, QQmlPropertyCache **) const;
+
typedef QVector<QQmlPropertyData> IndexCache;
- typedef QStringHash<QQmlPropertyData *> StringCache;
+ typedef QStringMultiHash<QPair<int, QQmlPropertyData *> > StringCache;
typedef QVector<int> AllowedRevisionCache;
+ QQmlPropertyData *findProperty(StringCache::ConstIterator it, QObject *, QQmlContextData *) const;
+ QQmlPropertyData *findProperty(StringCache::ConstIterator it, const QQmlVMEMetaObject *, QQmlContextData *) const;
+
+ QQmlPropertyData *ensureResolved(QQmlPropertyData*) const;
+
void resolve(QQmlPropertyData *) const;
void updateRecur(QQmlEngine *, const QMetaObject *);
+ template<typename K>
+ QQmlPropertyData *findNamedProperty(const K &key)
+ {
+ StringCache::mapped_type *it = stringCache.value(key);
+ return it ? it->second : 0;
+ }
+
+ template<typename K>
+ void setNamedProperty(const K &key, int index, QQmlPropertyData *data, bool isOverride)
+ {
+ stringCache.insert(key, qMakePair(index, data));
+ _hasPropertyOverrides |= isOverride;
+ }
+
QQmlEngine *engine;
QQmlPropertyCache *_parent;
AllowedRevisionCache allowedRevisionCache;
v8::Persistent<v8::Function> constructor;
- bool _ownMetaObject;
+ bool _hasPropertyOverrides : 1;
+ bool _ownMetaObject : 1;
const QMetaObject *_metaObject;
QByteArray _dynamicClassName;
QByteArray _dynamicStringData;
private:
QBiPointer<QQmlPropertyCache, const QMetaObject> _m;
};
-
+
QQmlPropertyData::QQmlPropertyData()
{
propType = 0;
overrideIndexIsProperty = false;
overrideIndex = -1;
revision = 0;
- metaObjectOffset = -1;
+ metaObjectOffset = -1;
flags = 0;
}
coreIndex == other.coreIndex &&
notifyIndex == other.notifyIndex &&
revision == other.revision &&
- (!isValueTypeVirtual() ||
- (valueTypeCoreIndex == other.valueTypeCoreIndex &&
+ (!isValueTypeVirtual() ||
+ (valueTypeCoreIndex == other.valueTypeCoreIndex &&
valueTypePropType == other.valueTypePropType));
}
int QQmlPropertyRawData::encodedIndex() const
{
- return isValueTypeVirtual()?(coreIndex | (valueTypeCoreIndex << 24)):coreIndex;
+ return isValueTypeVirtual()?(coreIndex | (valueTypeCoreIndex << 16)):coreIndex;
}
QQmlPropertyData *
return engine;
}
-QQmlPropertyData *QQmlPropertyCache::property(const QHashedV8String &str) const
-{
- QQmlPropertyData **rv = stringCache.value(str);
- if (rv && (*rv)->notFullyResolved()) resolve(*rv);
- return rv?*rv:0;
-}
-
int QQmlPropertyCache::propertyCount() const
{
return propertyIndexCacheStart + propertyIndexCache.count();