From fc662c4f48a9b24edad543c560752b90cf29f15b Mon Sep 17 00:00:00 2001 From: "pls.153" Date: Mon, 7 Mar 2022 19:38:25 +0100 Subject: [PATCH] revisions --- examples/app-template/app.pro | 1 + examples/swank-server/app.pro | 1 + readme-build.md | 4 ++++ readme-qml-live-preview-and-slime.md | 6 +++--- src/cpp/ecl_ext.h | 5 +---- src/cpp/ecl_fun.h | 5 +---- src/cpp/ecl_fun_plugin.h | 5 +---- src/cpp/lqml.cpp | 2 +- src/cpp/lqml.h | 4 +--- src/cpp/main.cpp | 9 ++++++--- src/cpp/main.h | 11 +++++++++++ src/cpp/marshal.h | 5 +---- src/cpp/qml_ext.h | 5 +---- src/cpp/qt_ecl.h | 5 +---- src/cpp/single_shot.h | 5 +---- src/lqml.pro | 3 ++- 16 files changed, 37 insertions(+), 39 deletions(-) create mode 100644 src/cpp/main.h diff --git a/examples/app-template/app.pro b/examples/app-template/app.pro index 344fe3f..004a853 100644 --- a/examples/app-template/app.pro +++ b/examples/app-template/app.pro @@ -49,6 +49,7 @@ ios { } LIBS += -llqml -llisp -Ltmp -lapp +HEADERS += ../../src/cpp/main.h SOURCES += ../../src/cpp/main.cpp RESOURCES = $$files(qml/*) diff --git a/examples/swank-server/app.pro b/examples/swank-server/app.pro index 101bde7..7d98fe1 100644 --- a/examples/swank-server/app.pro +++ b/examples/swank-server/app.pro @@ -57,6 +57,7 @@ ios { } LIBS += -llqml -llisp -Ltmp -lapp +HEADERS += ../../src/cpp/main.h SOURCES += ../../src/cpp/main.cpp RESOURCES = $$files(qml/*) diff --git a/readme-build.md b/readme-build.md index 52179af..6c8a031 100644 --- a/readme-build.md +++ b/readme-build.md @@ -14,6 +14,10 @@ Important note (see also `src/mkdirs.sh`) and rebuild the whole library for every single platform. +You may find that an example won't work anymore after upgrading LQML. This is +probably due to internal changes, so you better wipe off the whole example and +start over. + Build executable diff --git a/readme-qml-live-preview-and-slime.md b/readme-qml-live-preview-and-slime.md index ef0f08a..2e48735 100644 --- a/readme-qml-live-preview-and-slime.md +++ b/readme-qml-live-preview-and-slime.md @@ -8,9 +8,9 @@ reloading QML.* doesn't depend on Swank, and should therefore also be stable (it uses a local trivial web server).* -*You may even run both the desktop and mobile device auto reload simultaneously -(`swank-server` example only), because they both watch/load the same QML -sources.* +*You may even run both desktop and (one or more) mobile device auto reloads +simultaneously (`swank-server` example only), because they all watch/load the +same QML sources, if they point to the same desktop IP* QML Preview and Slime diff --git a/src/cpp/ecl_ext.h b/src/cpp/ecl_ext.h index 1366ac0..c43d236 100644 --- a/src/cpp/ecl_ext.h +++ b/src/cpp/ecl_ext.h @@ -1,5 +1,4 @@ -#ifndef ECL_EXT_H -#define ECL_EXT_H +#pragma once #undef SLOT @@ -87,5 +86,3 @@ void iniCLFunctions(); void error_msg(const char*, cl_object); QT_END_NAMESPACE - -#endif diff --git a/src/cpp/ecl_fun.h b/src/cpp/ecl_fun.h index ea4668e..09aa99d 100644 --- a/src/cpp/ecl_fun.h +++ b/src/cpp/ecl_fun.h @@ -1,8 +1,7 @@ // header to be included in external Qt libraries // for calling ECL functions from Qt -#ifndef ECL_FUN_H -#define ECL_FUN_H +#pragma once #include @@ -28,5 +27,3 @@ extern QVariant ecl_fun( const QVariant& = QVariant()); QT_END_NAMESPACE - -#endif diff --git a/src/cpp/ecl_fun_plugin.h b/src/cpp/ecl_fun_plugin.h index 2312a0a..7e5c2dc 100644 --- a/src/cpp/ecl_fun_plugin.h +++ b/src/cpp/ecl_fun_plugin.h @@ -3,8 +3,7 @@ // // does not depend on LQML -#ifndef ECL_FUN_PLUGIN -#define ECL_FUN_PLUGIN +#pragma once #undef SLOT @@ -439,5 +438,3 @@ QVariant ecl_fun(const QByteArray& pkgFun, } QT_END_NAMESPACE - -#endif diff --git a/src/cpp/lqml.cpp b/src/cpp/lqml.cpp index 0409d47..3e6a7ed 100644 --- a/src/cpp/lqml.cpp +++ b/src/cpp/lqml.cpp @@ -6,7 +6,7 @@ #include #include -const char LQML::version[] = "22.3.2"; // Mar 2022 +const char LQML::version[] = "22.3.3"; // Mar 2022 extern "C" void ini_LQML(cl_object); diff --git a/src/cpp/lqml.h b/src/cpp/lqml.h index ef728e2..a5e3639 100644 --- a/src/cpp/lqml.h +++ b/src/cpp/lqml.h @@ -1,5 +1,4 @@ -#ifndef LQML_H -#define LQML_H +#pragma once #undef SLOT @@ -49,4 +48,3 @@ public Q_SLOTS: QT_END_NAMESPACE -#endif diff --git a/src/cpp/main.cpp b/src/cpp/main.cpp index 0e4dd8b..997a88f 100644 --- a/src/cpp/main.cpp +++ b/src/cpp/main.cpp @@ -1,3 +1,6 @@ +#include "main.h" +#include "lqml.h" +#include "qml_ext.h" #include #include #include @@ -6,8 +9,6 @@ #include #include #include -#include "lqml.h" -#include "qml_ext.h" #ifdef Q_OS_MACOS #define ADD_MACOS_BUNDLE_IMPORT_PATH \ @@ -49,7 +50,8 @@ int main(int argc, char* argv[]) { app.setApplicationName(QFileInfo(app.applicationFilePath()).baseName()); QStringList arguments(QCoreApplication::arguments()); - QQuickView view; + Engine engine; + QQuickView view(&engine, nullptr); ADD_MACOS_BUNDLE_IMPORT_PATH view.engine()->addImportPath(QStringLiteral(":/")); if (qEnvironmentVariableIntValue("QT_QUICK_CORE_PROFILE")) { @@ -65,6 +67,7 @@ int main(int argc, char* argv[]) { Lisp lisp; view.engine()->rootContext()->setContextProperty("Lisp", &lisp); + view.engine()->rootContext()->setContextProperty("Engine", &engine); LQML lqml(argc, argv, &view); if (arguments.contains("-v") || arguments.contains("--version")) { diff --git a/src/cpp/main.h b/src/cpp/main.h new file mode 100644 index 0000000..ae6ead6 --- /dev/null +++ b/src/cpp/main.h @@ -0,0 +1,11 @@ +#pragma once + +#include + +class Engine : public QQmlEngine { + Q_OBJECT +public: + Engine(QObject* parent = nullptr) : QQmlEngine(parent) {} + + Q_INVOKABLE void clearCache() { clearComponentCache(); } +}; diff --git a/src/cpp/marshal.h b/src/cpp/marshal.h index 6302d72..7da9330 100644 --- a/src/cpp/marshal.h +++ b/src/cpp/marshal.h @@ -1,5 +1,4 @@ -#ifndef MARSHAL_H -#define MARSHAL_H +#pragma once #undef SLOT @@ -99,5 +98,3 @@ cl_object from_qobject_pointer(QObject*); QString toCamelCase(const QString&); QT_END_NAMESPACE - -#endif diff --git a/src/cpp/qml_ext.h b/src/cpp/qml_ext.h index 33cf0d1..a12ec8b 100644 --- a/src/cpp/qml_ext.h +++ b/src/cpp/qml_ext.h @@ -1,5 +1,4 @@ -#ifndef QML_EXT_H -#define QML_EXT_H +#pragma once #include @@ -36,5 +35,3 @@ public: }; QT_END_NAMESPACE - -#endif diff --git a/src/cpp/qt_ecl.h b/src/cpp/qt_ecl.h index a944f41..51c97c1 100644 --- a/src/cpp/qt_ecl.h +++ b/src/cpp/qt_ecl.h @@ -1,5 +1,4 @@ -#ifndef QT_ECL_H -#define QT_ECL_H +#pragma once #include @@ -25,5 +24,3 @@ QVariant ecl_fun( const QVariant& = QVariant()); QT_END_NAMESPACE - -#endif diff --git a/src/cpp/single_shot.h b/src/cpp/single_shot.h index 4952912..c6d3032 100644 --- a/src/cpp/single_shot.h +++ b/src/cpp/single_shot.h @@ -1,5 +1,4 @@ -#ifndef SINGLE_SHOT_H -#define SINGLE_SHOT_H +#pragma once #undef SLOT @@ -22,5 +21,3 @@ protected: }; QT_END_NAMESPACE - -#endif diff --git a/src/lqml.pro b/src/lqml.pro index e5a9db3..336e6f8 100644 --- a/src/lqml.pro +++ b/src/lqml.pro @@ -27,7 +27,8 @@ HEADERS += \ cpp/qml_ext.h \ cpp/lqml.h \ cpp/qt_ecl.h \ - cpp/single_shot.h + cpp/single_shot.h \ + cpp/main.h SOURCES += \ cpp/marshal.cpp \