diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/declarative/graphicsitems/qmlgraphicsgridview.cpp | 3 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qmlgraphicslistview.cpp | 3 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qmlgraphicspathview.cpp | 3 | ||||
-rw-r--r-- | src/declarative/qml/qmlbindingvme.cpp | 18 | ||||
-rw-r--r-- | src/declarative/qml/qmlcleanup.cpp | 4 | ||||
-rw-r--r-- | src/declarative/qml/qmlcompileddata.cpp | 15 | ||||
-rw-r--r-- | src/declarative/qml/qmlcompiler_p.h | 8 | ||||
-rw-r--r-- | src/declarative/qml/qmlcompositetypemanager.cpp | 2 | ||||
-rw-r--r-- | src/declarative/qml/qmldom.cpp | 2 | ||||
-rw-r--r-- | src/declarative/qml/qmltypenamescriptclass.cpp | 2 | ||||
-rw-r--r-- | src/declarative/util/qmlstategroup.cpp | 34 | ||||
-rw-r--r-- | src/declarative/util/qmlstategroup_p.h | 2 | ||||
-rw-r--r-- | src/script/bridge/qscriptdeclarativeclass_p.h | 2 |
13 files changed, 77 insertions, 21 deletions
diff --git a/src/declarative/graphicsitems/qmlgraphicsgridview.cpp b/src/declarative/graphicsitems/qmlgraphicsgridview.cpp index 0ba1491..2fad3bb 100644 --- a/src/declarative/graphicsitems/qmlgraphicsgridview.cpp +++ b/src/declarative/graphicsitems/qmlgraphicsgridview.cpp @@ -874,6 +874,9 @@ void QmlGraphicsGridView::setModel(const QVariant &model) The index is exposed as an accessible \c index property. Properties of the model are also available depending upon the type of \l {qmlmodels}{Data Model}. + Note that the GridView will layout the items based on the size of the root item + in the delegate. + Here is an example delegate: \snippet doc/src/snippets/declarative/gridview/gridview.qml 0 */ diff --git a/src/declarative/graphicsitems/qmlgraphicslistview.cpp b/src/declarative/graphicsitems/qmlgraphicslistview.cpp index 6460a69..3a59c6c 100644 --- a/src/declarative/graphicsitems/qmlgraphicslistview.cpp +++ b/src/declarative/graphicsitems/qmlgraphicslistview.cpp @@ -1554,6 +1554,9 @@ void QmlGraphicsListView::setModel(const QVariant &model) The index is exposed as an accessible \c index property. Properties of the model are also available depending upon the type of \l {qmlmodels}{Data Model}. + Note that the ListView will layout the items based on the size of the root item + in the delegate. + Here is an example delegate: \snippet doc/src/snippets/declarative/listview/listview.qml 0 */ diff --git a/src/declarative/graphicsitems/qmlgraphicspathview.cpp b/src/declarative/graphicsitems/qmlgraphicspathview.cpp index b9c9e05..8ac57e0 100644 --- a/src/declarative/graphicsitems/qmlgraphicspathview.cpp +++ b/src/declarative/graphicsitems/qmlgraphicspathview.cpp @@ -302,6 +302,9 @@ void QmlGraphicsPathView::setDragMargin(qreal dragMargin) The index is exposed as an accessible \c index property. Properties of the model are also available depending upon the type of \l {qmlmodels}{Data Model}. + Note that the PathView will layout the items based on the size of the root + item in the delegate. + Here is an example delegate: \snippet doc/src/snippets/declarative/pathview/pathview.qml 1 */ diff --git a/src/declarative/qml/qmlbindingvme.cpp b/src/declarative/qml/qmlbindingvme.cpp index 29391a6..81e05c1 100644 --- a/src/declarative/qml/qmlbindingvme.cpp +++ b/src/declarative/qml/qmlbindingvme.cpp @@ -472,6 +472,19 @@ static bool findproperty(QObject *obj, Register *output, void *args[] = { output->typeDataPtr(), 0 }; QMetaObject::metacall(obj, QMetaObject::ReadProperty, property->coreIndex, args); output->settype(QMetaType::QReal); + } else if (property->propType == QMetaType::Int) { + void *args[] = { output->typeDataPtr(), 0 }; + QMetaObject::metacall(obj, QMetaObject::ReadProperty, property->coreIndex, args); + output->settype(QMetaType::Int); + } else if (property->propType == QMetaType::Bool) { + void *args[] = { output->typeDataPtr(), 0 }; + QMetaObject::metacall(obj, QMetaObject::ReadProperty, property->coreIndex, args); + output->settype(QMetaType::Bool); + } else if (property->propType == QMetaType::QString) { + new (output->typeDataPtr()) QString(); + void *args[] = { output->typeDataPtr(), 0 }; + QMetaObject::metacall(obj, QMetaObject::ReadProperty, property->coreIndex, args); + output->settype(QMetaType::QString); } else { new (output->typeDataPtr()) QVariant(obj->metaObject()->property(property->coreIndex).read(obj)); @@ -570,7 +583,6 @@ inline static qreal toReal(Register *reg, int type, bool *ok = 0) if (type == QMetaType::QReal) { return reg->getqreal(); } else if (type == qMetaTypeId<QVariant>()) { - *ok = true; return reg->getvariantptr()->toReal(); } else { if (ok) *ok = false; @@ -624,6 +636,8 @@ inline static QUrl toUrl(Register *reg, int type, QmlContextPrivate *context, bo if (ok) *ok = false; return QUrl(); } + } else if (type == QMetaType::QString) { + base = QUrl(*reg->getstringptr()); } else { if (ok) *ok = false; return QUrl(); @@ -882,6 +896,8 @@ void QmlBindingVME::run(const char *programData, int instrIndex, int type = registers[instr->cleanup.reg].gettype(); if (type == qMetaTypeId<QVariant>()) { ((QVariant *)registers[instr->cleanup.reg].typeDataPtr())->~QVariant(); + } else if (type == QMetaType::QString) { + ((QString *)registers[instr->cleanup.reg].typeDataPtr())->~QString(); } } break; diff --git a/src/declarative/qml/qmlcleanup.cpp b/src/declarative/qml/qmlcleanup.cpp index 0da6452..599e4e7 100644 --- a/src/declarative/qml/qmlcleanup.cpp +++ b/src/declarative/qml/qmlcleanup.cpp @@ -61,7 +61,9 @@ Create a QmlCleanup for \a engine QmlCleanup::QmlCleanup(QmlEngine *engine) : prev(0), next(0) { - Q_ASSERT(engine); + if (!engine) + return; + QmlEnginePrivate *p = QmlEnginePrivate::get(engine); if (p->cleanup) next = p->cleanup; diff --git a/src/declarative/qml/qmlcompileddata.cpp b/src/declarative/qml/qmlcompileddata.cpp index de9bf96..48a0893 100644 --- a/src/declarative/qml/qmlcompileddata.cpp +++ b/src/declarative/qml/qmlcompileddata.cpp @@ -161,8 +161,8 @@ int QmlCompiledData::indexForLocation(const QmlParser::LocationSpan &l) return rv; } -QmlCompiledData::QmlCompiledData() -: importCache(0), root(0), rootPropertyCache(0) +QmlCompiledData::QmlCompiledData(QmlEngine *engine) +: QmlCleanup(engine), importCache(0), root(0), rootPropertyCache(0) { } @@ -189,6 +189,17 @@ QmlCompiledData::~QmlCompiledData() qDeleteAll(cachedClosures); } +void QmlCompiledData::clear() +{ + qDeleteAll(cachedPrograms); + qDeleteAll(cachedClosures); + for (int ii = 0; ii < cachedClosures.count(); ++ii) + cachedClosures[ii] = 0; + for (int ii = 0; ii < cachedPrograms.count(); ++ii) + cachedPrograms[ii] = 0; +} + + QObject *QmlCompiledData::TypeReference::createInstance(QmlContext *ctxt, const QBitField &bindings) const { if (type) { diff --git a/src/declarative/qml/qmlcompiler_p.h b/src/declarative/qml/qmlcompiler_p.h index c0e50e4..732fbad 100644 --- a/src/declarative/qml/qmlcompiler_p.h +++ b/src/declarative/qml/qmlcompiler_p.h @@ -74,10 +74,10 @@ class QmlComponent; class QmlContext; class QScriptProgram; -class Q_AUTOTEST_EXPORT QmlCompiledData : public QmlRefCount +class Q_AUTOTEST_EXPORT QmlCompiledData : public QmlRefCount, public QmlCleanup { public: - QmlCompiledData(); + QmlCompiledData(QmlEngine *engine); virtual ~QmlCompiledData(); QString name; @@ -123,6 +123,10 @@ public: QList<QUrl> urls; void dumpInstructions(); + +protected: + virtual void clear(); // From QmlCleanup + private: void dump(QmlInstruction *, int idx = -1); QmlCompiledData(const QmlCompiledData &other); diff --git a/src/declarative/qml/qmlcompositetypemanager.cpp b/src/declarative/qml/qmlcompositetypemanager.cpp index 29959cb..22f2df3 100644 --- a/src/declarative/qml/qmlcompositetypemanager.cpp +++ b/src/declarative/qml/qmlcompositetypemanager.cpp @@ -125,7 +125,7 @@ QmlCompositeTypeData::toCompiledComponent(QmlEngine *engine) { if (status == Complete && !compiledComponent) { - compiledComponent = new QmlCompiledData; + compiledComponent = new QmlCompiledData(engine); compiledComponent->url = imports.baseUrl(); compiledComponent->name = compiledComponent->url.toString(); diff --git a/src/declarative/qml/qmldom.cpp b/src/declarative/qml/qmldom.cpp index e46ea96..52530db 100644 --- a/src/declarative/qml/qmldom.cpp +++ b/src/declarative/qml/qmldom.cpp @@ -145,7 +145,7 @@ bool QmlDomDocument::load(QmlEngine *engine, const QByteArray &data, const QUrl d->errors.clear(); d->imports.clear(); - QmlCompiledData *component = new QmlCompiledData; + QmlCompiledData *component = new QmlCompiledData(engine); QmlCompiler compiler; QmlCompositeTypeData *td = ((QmlEnginePrivate *)QmlEnginePrivate::get(engine))->typeManager.getImmediate(data, url); diff --git a/src/declarative/qml/qmltypenamescriptclass.cpp b/src/declarative/qml/qmltypenamescriptclass.cpp index c4c5f53..3e4b08c 100644 --- a/src/declarative/qml/qmltypenamescriptclass.cpp +++ b/src/declarative/qml/qmltypenamescriptclass.cpp @@ -147,7 +147,7 @@ QmlTypeNameScriptClass::Value QmlTypeNameScriptClass::property(Object *obj, cons } else if (object) { return ep->objectClass->property(object, name); } else { - return QScriptValue(enumValue); + return Value(&ep->scriptEngine, enumValue); } } diff --git a/src/declarative/util/qmlstategroup.cpp b/src/declarative/util/qmlstategroup.cpp index 373d457..d4db2b9 100644 --- a/src/declarative/util/qmlstategroup.cpp +++ b/src/declarative/util/qmlstategroup.cpp @@ -88,7 +88,7 @@ public: QmlTransition *findTransition(const QString &from, const QString &to); void setCurrentStateInternal(const QString &state, bool = false); - void updateAutoState(); + bool updateAutoState(); }; /*! @@ -231,25 +231,30 @@ void QmlStateGroup::componentComplete() { Q_D(QmlStateGroup); d->componentComplete = true; - d->updateAutoState(); - if (!d->currentState.isEmpty()) { + + if (d->updateAutoState()) { + return; + } else if (!d->currentState.isEmpty()) { QString cs = d->currentState; d->currentState = QString(); d->setCurrentStateInternal(cs, true); } } -void QmlStateGroup::updateAutoState() +/*! + Returns true if the state was changed, otherwise false. +*/ +bool QmlStateGroup::updateAutoState() { Q_D(QmlStateGroup); - d->updateAutoState(); + return d->updateAutoState(); } -void QmlStateGroupPrivate::updateAutoState() +bool QmlStateGroupPrivate::updateAutoState() { Q_Q(QmlStateGroup); if (!componentComplete) - return; + return false; bool revert = false; for (int ii = 0; ii < states.count(); ++ii) { @@ -260,16 +265,25 @@ void QmlStateGroupPrivate::updateAutoState() if (stateChangeDebug()) qWarning() << "Setting auto state due to:" << state->when()->expression(); - q->setState(state->name()); - return; + if (currentState != state->name()) { + q->setState(state->name()); + return true; + } else { + return false; + } } else if (state->name() == currentState) { revert = true; } } } } - if (revert) + if (revert) { + bool rv = currentState != QString(); q->setState(QString()); + return rv; + } else { + return false; + } } QmlTransition *QmlStateGroupPrivate::findTransition(const QString &from, const QString &to) diff --git a/src/declarative/util/qmlstategroup_p.h b/src/declarative/util/qmlstategroup_p.h index 82cc504..112c9eb 100644 --- a/src/declarative/util/qmlstategroup_p.h +++ b/src/declarative/util/qmlstategroup_p.h @@ -82,7 +82,7 @@ Q_SIGNALS: private: friend class QmlState; - void updateAutoState(); + bool updateAutoState(); void removeState(QmlState *state); }; diff --git a/src/script/bridge/qscriptdeclarativeclass_p.h b/src/script/bridge/qscriptdeclarativeclass_p.h index 87ab964..eb94390 100644 --- a/src/script/bridge/qscriptdeclarativeclass_p.h +++ b/src/script/bridge/qscriptdeclarativeclass_p.h @@ -47,7 +47,7 @@ class QScriptContext; class Q_SCRIPT_EXPORT QScriptDeclarativeClass { public: - class Value + class Q_SCRIPT_EXPORT Value { public: Value(); |