diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2019-04-04 16:00:36 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2019-04-10 19:46:48 +0000 |
commit | 65299ce292180a845eb2d76756faeeaa1456d8f0 (patch) | |
tree | e37332324436e64d57effea735b15bac7ee23fab /src/qml/types | |
parent | 2ccd4c3672e5db2c25ca0f8df439fe8f646aa942 (diff) |
Remove QQmlV4Handle
This is just an alias for QV4::ReturnedValue. We can as well use the
latter.
Change-Id: Ibd2c038a3ca726b39a8f0f05e02922adb9fccbdb
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/types')
-rw-r--r-- | src/qml/types/qqmldelegatemodel.cpp | 20 | ||||
-rw-r--r-- | src/qml/types/qqmldelegatemodel_p.h | 5 | ||||
-rw-r--r-- | src/qml/types/qqmllistmodel.cpp | 8 | ||||
-rw-r--r-- | src/qml/types/qqmllistmodel_p.h | 4 | ||||
-rw-r--r-- | src/qml/types/qqmllistmodelworkeragent.cpp | 4 | ||||
-rw-r--r-- | src/qml/types/qqmllistmodelworkeragent_p.h | 4 | ||||
-rw-r--r-- | src/qml/types/qquickworkerscript.cpp | 8 | ||||
-rw-r--r-- | src/qml/types/qquickworkerscript_p.h | 3 |
8 files changed, 25 insertions, 31 deletions
diff --git a/src/qml/types/qqmldelegatemodel.cpp b/src/qml/types/qqmldelegatemodel.cpp index 0b95c7c3e7..0e57119368 100644 --- a/src/qml/types/qqmldelegatemodel.cpp +++ b/src/qml/types/qqmldelegatemodel.cpp @@ -2419,17 +2419,15 @@ void QQmlDelegateModelGroupPrivate::setModel(QQmlDelegateModel *m, Compositor::G bool QQmlDelegateModelGroupPrivate::isChangedConnected() { Q_Q(QQmlDelegateModelGroup); - IS_SIGNAL_CONNECTED(q, QQmlDelegateModelGroup, changed, (const QQmlV4Handle &,const QQmlV4Handle &)); + IS_SIGNAL_CONNECTED(q, QQmlDelegateModelGroup, changed, (const QJSValue &,const QJSValue &)); } void QQmlDelegateModelGroupPrivate::emitChanges(QV4::ExecutionEngine *v4) { Q_Q(QQmlDelegateModelGroup); if (isChangedConnected() && !changeSet.isEmpty()) { - QV4::Scope scope(v4); - QV4::ScopedValue removed(scope, engineData(scope.engine)->array(v4, changeSet.removes())); - QV4::ScopedValue inserted(scope, engineData(scope.engine)->array(v4, changeSet.inserts())); - emit q->changed(QQmlV4Handle(removed), QQmlV4Handle(inserted)); + emit q->changed(QJSValue(v4, engineData(v4)->array(v4, changeSet.removes())), + QJSValue(v4, engineData(v4)->array(v4, changeSet.inserts()))); } if (changeSet.difference() != 0) emit q->countChanged(); @@ -2607,18 +2605,18 @@ void QQmlDelegateModelGroup::setDefaultInclude(bool include) \endlist */ -QQmlV4Handle QQmlDelegateModelGroup::get(int index) +QJSValue QQmlDelegateModelGroup::get(int index) { Q_D(QQmlDelegateModelGroup); if (!d->model) - return QQmlV4Handle(QV4::Encode::undefined()); + return QJSValue(); QQmlDelegateModelPrivate *model = QQmlDelegateModelPrivate::get(d->model); if (!model->m_context || !model->m_context->isValid()) { - return QQmlV4Handle(QV4::Encode::undefined()); + return QJSValue(); } else if (index < 0 || index >= model->m_compositor.count(d->group)) { qmlWarning(this) << tr("get: index out of range"); - return QQmlV4Handle(QV4::Encode::undefined()); + return QJSValue(); } Compositor::iterator it = model->m_compositor.find(d->group, index); @@ -2630,7 +2628,7 @@ QQmlV4Handle QQmlDelegateModelGroup::get(int index) cacheItem = model->m_adaptorModel.createItem( model->m_cacheMetaType, it.modelIndex()); if (!cacheItem) - return QQmlV4Handle(QV4::Encode::undefined()); + return QJSValue(); cacheItem->groups = it->flags; model->m_cache.insert(it.cacheIndex, cacheItem); @@ -2646,7 +2644,7 @@ QQmlV4Handle QQmlDelegateModelGroup::get(int index) o->setPrototypeOf(p); ++cacheItem->scriptRef; - return QQmlV4Handle(o); + return QJSValue(v4, o->asReturnedValue()); } bool QQmlDelegateModelGroupPrivate::parseIndex(const QV4::Value &value, int *index, Compositor::Group *group) const diff --git a/src/qml/types/qqmldelegatemodel_p.h b/src/qml/types/qqmldelegatemodel_p.h index fbf3614a7c..2684162514 100644 --- a/src/qml/types/qqmldelegatemodel_p.h +++ b/src/qml/types/qqmldelegatemodel_p.h @@ -59,7 +59,6 @@ #include <QtCore/qabstractitemmodel.h> #include <QtCore/qstringlist.h> -#include <private/qv8engine_p.h> #include <private/qqmlglobal_p.h> QT_REQUIRE_CONFIG(qml_delegate_model); @@ -179,7 +178,7 @@ public: bool defaultInclude() const; void setDefaultInclude(bool include); - Q_INVOKABLE QQmlV4Handle get(int index); + Q_INVOKABLE QJSValue get(int index); public Q_SLOTS: void insert(QQmlV4Function *); @@ -195,7 +194,7 @@ Q_SIGNALS: void countChanged(); void nameChanged(); void defaultIncludeChanged(); - void changed(const QQmlV4Handle &removed, const QQmlV4Handle &inserted); + void changed(const QJSValue &removed, const QJSValue &inserted); private: Q_DECLARE_PRIVATE(QQmlDelegateModelGroup) }; diff --git a/src/qml/types/qqmllistmodel.cpp b/src/qml/types/qqmllistmodel.cpp index 565e60b3c1..5b5bcd8464 100644 --- a/src/qml/types/qqmllistmodel.cpp +++ b/src/qml/types/qqmllistmodel.cpp @@ -2545,7 +2545,7 @@ void QQmlListModel::append(QQmlV4Function *args) \sa append() */ -QQmlV4Handle QQmlListModel::get(int index) const +QJSValue QQmlListModel::get(int index) const { QV4::Scope scope(engine()); QV4::ScopedValue result(scope, QV4::Value::undefinedValue()); @@ -2568,7 +2568,7 @@ QQmlV4Handle QQmlListModel::get(int index) const } } - return QQmlV4Handle(result); + return QJSValue(engine(), result->asReturnedValue()); } /*! @@ -2587,10 +2587,10 @@ QQmlV4Handle QQmlListModel::get(int index) const \sa append() */ -void QQmlListModel::set(int index, const QQmlV4Handle &handle) +void QQmlListModel::set(int index, const QJSValue &value) { QV4::Scope scope(engine()); - QV4::ScopedObject object(scope, handle); + QV4::ScopedObject object(scope, QJSValuePrivate::getValue(&value)); if (!object) { qmlWarning(this) << tr("set: value is not an object"); diff --git a/src/qml/types/qqmllistmodel_p.h b/src/qml/types/qqmllistmodel_p.h index 95b797c898..471e33aa5a 100644 --- a/src/qml/types/qqmllistmodel_p.h +++ b/src/qml/types/qqmllistmodel_p.h @@ -100,8 +100,8 @@ public: Q_INVOKABLE void remove(QQmlV4Function *args); Q_INVOKABLE void append(QQmlV4Function *args); Q_INVOKABLE void insert(QQmlV4Function *args); - Q_INVOKABLE QQmlV4Handle get(int index) const; - Q_INVOKABLE void set(int index, const QQmlV4Handle &); + Q_INVOKABLE QJSValue get(int index) const; + Q_INVOKABLE void set(int index, const QJSValue &value); Q_INVOKABLE void setProperty(int index, const QString& property, const QVariant& value); Q_INVOKABLE void move(int from, int to, int count); Q_INVOKABLE void sync(); diff --git a/src/qml/types/qqmllistmodelworkeragent.cpp b/src/qml/types/qqmllistmodelworkeragent.cpp index fe3eaa3198..f7cb08dcf4 100644 --- a/src/qml/types/qqmllistmodelworkeragent.cpp +++ b/src/qml/types/qqmllistmodelworkeragent.cpp @@ -114,12 +114,12 @@ void QQmlListModelWorkerAgent::insert(QQmlV4Function *args) m_copy->insert(args); } -QQmlV4Handle QQmlListModelWorkerAgent::get(int index) const +QJSValue QQmlListModelWorkerAgent::get(int index) const { return m_copy->get(index); } -void QQmlListModelWorkerAgent::set(int index, const QQmlV4Handle &value) +void QQmlListModelWorkerAgent::set(int index, const QJSValue &value) { m_copy->set(index, value); } diff --git a/src/qml/types/qqmllistmodelworkeragent_p.h b/src/qml/types/qqmllistmodelworkeragent_p.h index ae2d4b11e0..69d1785618 100644 --- a/src/qml/types/qqmllistmodelworkeragent_p.h +++ b/src/qml/types/qqmllistmodelworkeragent_p.h @@ -85,8 +85,8 @@ public: Q_INVOKABLE void remove(QQmlV4Function *args); Q_INVOKABLE void append(QQmlV4Function *args); Q_INVOKABLE void insert(QQmlV4Function *args); - Q_INVOKABLE QQmlV4Handle get(int index) const; - Q_INVOKABLE void set(int index, const QQmlV4Handle &); + Q_INVOKABLE QJSValue get(int index) const; + Q_INVOKABLE void set(int index, const QJSValue &value); Q_INVOKABLE void setProperty(int index, const QString& property, const QVariant& value); Q_INVOKABLE void move(int from, int to, int count); Q_INVOKABLE void sync(); diff --git a/src/qml/types/qquickworkerscript.cpp b/src/qml/types/qquickworkerscript.cpp index aaa89846aa..c081c9e7fc 100644 --- a/src/qml/types/qquickworkerscript.cpp +++ b/src/qml/types/qquickworkerscript.cpp @@ -647,12 +647,10 @@ void QQuickWorkerScript::componentComplete() bool QQuickWorkerScript::event(QEvent *event) { if (event->type() == (QEvent::Type)WorkerDataEvent::WorkerData) { - QQmlEngine *engine = qmlEngine(this); - if (engine) { + if (QQmlEngine *engine = qmlEngine(this)) { + QV4::ExecutionEngine *v4 = engine->handle(); WorkerDataEvent *workerEvent = static_cast<WorkerDataEvent *>(event); - QV4::Scope scope(engine->handle()); - QV4::ScopedValue value(scope, QV4::Serialize::deserialize(workerEvent->data(), scope.engine)); - emit message(QQmlV4Handle(value)); + emit message(QJSValue(v4, QV4::Serialize::deserialize(workerEvent->data(), v4))); } return true; } else if (event->type() == (QEvent::Type)WorkerErrorEvent::WorkerError) { diff --git a/src/qml/types/qquickworkerscript_p.h b/src/qml/types/qquickworkerscript_p.h index 1a8d2ab076..87cf2e9754 100644 --- a/src/qml/types/qquickworkerscript_p.h +++ b/src/qml/types/qquickworkerscript_p.h @@ -83,7 +83,6 @@ private: }; class QQmlV4Function; -class QQmlV4Handle; class Q_AUTOTEST_EXPORT QQuickWorkerScript : public QObject, public QQmlParserStatus { Q_OBJECT @@ -102,7 +101,7 @@ public Q_SLOTS: Q_SIGNALS: void sourceChanged(); - void message(const QQmlV4Handle &messageObject); + void message(const QJSValue &messageObject); protected: void classBegin() override; |