Showing the changes to plugins/JSAPIExample/src/JSAPIExample.cpp (1 of 170 files). Show all
Unified · Split
| @@ -17,6 +17,7 @@ · 16 unmodified lines | ||
| 17 | 17 | #include <QtCore/QSharedPointer> |
| 18 | 18 | #include <QtCore/QJsonObject> |
| 19 | 19 | #include <QtCore/QLoggingCategory> |
| 20 | +#include <QtCore/QSharedPointer> | |
| 20 | 21 | #include <QtCore/QThread> |
| 21 | 22 | #include <QtCore/QTimer> |
| 22 | 23 | |
| @@ -65,7 +66,7 @@ namespace REPLACE_ME_WITH_UNIQUE_NAME { · 42 unmodified lines | ||
| 65 | 66 | qCWarning(logger) << "registering w/ScriptInitializerMixin..." << scriptInit.data(); |
| 66 | 67 | scriptInit->registerScriptInitializer([this](ScriptEngine* engine) { |
| 67 | 68 | auto value = engine->newQObject(this, ScriptEngine::QtOwnership); |
| 68 | − engine->globalObject()->setProperty(objectName(), value); | |
| 69 | + engine->globalObject().setProperty(objectName(), value); | |
| 69 | 70 | // qCDebug(logger) << "setGlobalInstance" << objectName() << engine->property("fileName"); |
| 70 | 71 | }); |
| 71 | 72 | // qCInfo(logger) << "plugin loaded" << qApp << toString() << QThread::currentThread(); |
| @@ -73,7 +74,7 @@ namespace REPLACE_ME_WITH_UNIQUE_NAME { · 1 unmodified line | ||
| 73 | 74 | |
| 74 | 75 | // NOTES: everything within the "public slots:" section below will be available from JS via overall plugin QObject |
| 75 | 76 | // also, to demonstrate future-proofing JS API code, QVariant's are used throughout most of these examples -- |
| 76 | − // which still makes them very Qt-specific, but avoids depending directly on deprecated ScriptValuePointer APIs. | |
| 77 | + // which still makes them very Qt-specific, but avoids depending directly on deprecated ScriptValue APIs. | |
| 77 | 78 | // (as such this plugin class and its methods remain forward-compatible with other engines like QML's QJSEngine) |
| 78 | 79 | |
| 79 | 80 | public slots: |
| @@ -160,14 +161,14 @@ namespace REPLACE_ME_WITH_UNIQUE_NAME { · 80 unmodified lines | ||
| 160 | 161 | * print("all example::* keys", settings.allKeys()); |
| 161 | 162 | * settings = null; // optional best pratice; allows the object to be reclaimed ASAP by the JS garbage collector |
| 162 | 163 | */ |
| 163 | − ScriptValuePointer getScopedSettings(const QString& scope) { | |
| 164 | + ScriptValue getScopedSettings(const QString& scope) { | |
| 164 | 165 | auto engine = Scriptable::engine(); |
| 165 | 166 | if (!engine) { |
| 166 | − return ScriptValuePointer(); | |
| 167 | + return ScriptValue(); | |
| 167 | 168 | } |
| 168 | 169 | auto manager = engine->manager(); |
| 169 | 170 | if (!manager) { |
| 170 | − return ScriptValuePointer(); | |
| 171 | + return ScriptValue(); | |
| 171 | 172 | } |
| 172 | 173 | QString error; |
| 173 | 174 | auto cppValue = createScopedSettings(scope, manager, error); |