From 91ac466545ef432089c349b6a0f329260976be4b Mon Sep 17 00:00:00 2001 From: Allan CORNET Date: Wed, 9 Oct 2024 19:19:58 +0200 Subject: [PATCH] Qt 6.8 support (used on Windows x64) --- .github/workflows/ccpp.yml | 18 +++++++++--------- CHANGELOG.md | 2 +- bin/qt.iss | 1 + modules/qml_engine/src/cpp/QVariantArrayOf.cpp | 12 ++++++++++++ modules/qml_engine/src/cpp/QmlEngine.cpp | 12 ++++++++++++ modules/qml_engine/tests/test_QObject_isprop.m | 10 ++++++++-- 6 files changed, 43 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml index 5696c39194..ee51bc36c5 100644 --- a/.github/workflows/ccpp.yml +++ b/.github/workflows/ccpp.yml @@ -132,7 +132,7 @@ jobs: brew install tbb - name: Install Qt - uses: jurplel/install-qt-action@v3 + uses: jurplel/install-qt-action@v4 with: version: "6.4.2" - name: Checkout @@ -219,7 +219,7 @@ jobs: brew install tbb - name: Install Qt - uses: jurplel/install-qt-action@v3 + uses: jurplel/install-qt-action@v4 with: version: "6.4.2" - name: Checkout @@ -797,7 +797,7 @@ jobs: python %GITHUB_WORKSPACE%/tools/update_version/update_version.py - name: Install Qt 5.15.2 - uses: jurplel/install-qt-action@v3 + uses: jurplel/install-qt-action@v4 with: version: "5.15.2" host: "windows" @@ -910,13 +910,13 @@ jobs: - name: Add msbuild to PATH uses: microsoft/setup-msbuild@v2 - - name: Install Qt 6.7.1 - uses: jurplel/install-qt-action@v3 + - name: Install Qt 6.8.0 + uses: jurplel/install-qt-action@v4 with: - version: "6.7.1" + version: "6.8.0" host: "windows" target: "desktop" - arch: "win64_msvc2019_64" + arch: "win64_msvc2022_64" dir: "C:/install/QT6/" install-deps: "true" modules: "qtwebengine" @@ -950,7 +950,7 @@ jobs: - name: Install dependencies run: | - set QTDIR64=C:\install\QT6\Qt\6.7.1\msvc2019_64 + set QTDIR64=C:\install\QT6\Qt\6.8.0\msvc2019_64 set QTDIR=%QTDIR64% cd .. git clone https://github.com/nelson-lang/nelson-thirdparty-x64.git @@ -961,7 +961,7 @@ jobs: - name: Build Nelson run: | - set QTDIR64=C:\install\QT6\Qt\6.7.1\msvc2019_64 + set QTDIR64=C:\install\QT6\Qt\6.8.0\msvc2019_64 set QTDIR=%QTDIR64% SET PATH=C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\current\Bin\;C:\Program Files (x86)\Inno Setup 6;%PATH% call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" diff --git a/CHANGELOG.md b/CHANGELOG.md index 166e2b1ea9..d1e10e6dbe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,11 +10,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - `end` magic keyword can be overloaded for classes (applied to `table` class). - - [#1250](http://github.com/nelson-lang/nelson/issues/1250) `head`, `tail` functions for table and array. ### Changed +- Qt 6.8 LTS support (used on Windows 64 bits binary). - Python 3.13.0 on Windows. ## 1.8.0 (2024-10-04) diff --git a/bin/qt.iss b/bin/qt.iss index 2364b51c44..cd3de9b5c4 100644 --- a/bin/qt.iss +++ b/bin/qt.iss @@ -65,6 +65,7 @@ Source: {#RootPath}bin\{#BinPath}\Qt6QuickLayouts.dll; DestDir: {app}\bin\{#BinP Source: {#RootPath}bin\{#BinPath}\Qt6QuickControls2Basic.dll; DestDir: {app}\bin\{#BinPath}\;Components: {#COMPONENT_GUI}; Source: {#RootPath}bin\{#BinPath}\Qt6QuickControls2Fusion.dll; DestDir: {app}\bin\{#BinPath}\;Components: {#COMPONENT_GUI}; Source: {#RootPath}bin\{#BinPath}\Qt6QuickControls2FusionStyleImpl.dll; DestDir: {app}\bin\{#BinPath}\;Components: {#COMPONENT_GUI}; +Source: {#RootPath}bin\{#BinPath}\Qt6QmlMeta.dll; DestDir: {app}\bin\{#BinPath}\;Flags: skipifsourcedoesntexist;Components: {#COMPONENT_GUI}; #endif ;============================================================================== Source: {#RootPath}bin\{#BinPath}\qhelpgenerator.exe; DestDir: {app}\bin\{#BinPath}\;Components: {#COMPONENT_GUI}; diff --git a/modules/qml_engine/src/cpp/QVariantArrayOf.cpp b/modules/qml_engine/src/cpp/QVariantArrayOf.cpp index bd3a2e9a16..16b0f5f945 100644 --- a/modules/qml_engine/src/cpp/QVariantArrayOf.cpp +++ b/modules/qml_engine/src/cpp/QVariantArrayOf.cpp @@ -22,6 +22,9 @@ #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) #include #endif +#if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0) +#include +#endif #include #include #include @@ -239,7 +242,11 @@ QVariantToArrayOf(QVariant Q) } break; case QMetaType::Type::QDateTime: { QDateTime qdatetime = qvariant_cast(Q); +#if (QT_VERSION >= QT_VERSION_CHECK(6, 8, 0)) + qdatetime.setTimeZone(QTimeZone::UTC); +#else qdatetime.setTimeSpec(Qt::UTC); // FORCE UTC +#endif QDate qdate = qdatetime.date(); QTime qtime = qdatetime.time(); int32* arrayInt32 = (int32*)ArrayOf::allocateArrayOf(NLS_INT32, 7, stringVector(), false); @@ -683,7 +690,12 @@ ArrayOfToQVariant(ArrayOf A, int id) QDate date(arrayInt[0], arrayInt[1], arrayInt[2]); QTime time(arrayInt[3], arrayInt[4], arrayInt[5], arrayInt[6]); QDateTime datetime(date, time); + +#if (QT_VERSION >= QT_VERSION_CHECK(6, 8, 0)) + datetime.setTimeZone(QTimeZone::UTC); +#else datetime.setTimeSpec(Qt::UTC); // FORCE UTC +#endif res = datetime; } break; case QMetaType::Type::QUrl: { diff --git a/modules/qml_engine/src/cpp/QmlEngine.cpp b/modules/qml_engine/src/cpp/QmlEngine.cpp index 623a888cb3..aa5e121669 100644 --- a/modules/qml_engine/src/cpp/QmlEngine.cpp +++ b/modules/qml_engine/src/cpp/QmlEngine.cpp @@ -298,9 +298,21 @@ QJsValueToQVariant(QJSValue value) if (value.isNumber()) { return value.toNumber(); } + +#if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0) + if (value.isBool() || value.isNumber() || value.isNull() || value.isString() + || value.isUndefined() || value.isQObject() || value.isQMetaObject() || value.isObject() + || value.isDate() || value.isRegExp() || value.isArray() || value.isError() + || value.isUrl()) { + return value.toString(); + } else { + return value.toVariant(); + } +#else if (value.isVariant()) { return value.toVariant(); } +#endif return value.toString(); } //============================================================================= diff --git a/modules/qml_engine/tests/test_QObject_isprop.m b/modules/qml_engine/tests/test_QObject_isprop.m index abd29a84d7..d48a4721cb 100644 --- a/modules/qml_engine/tests/test_QObject_isprop.m +++ b/modules/qml_engine/tests/test_QObject_isprop.m @@ -26,8 +26,14 @@ qobj.z = 1; assert_istrue(isprop(qobj, 'z')); else - assert_istrue(isprop(qobj, 'z')); - assert_isequal(qobj.z, 0); + if (semver(qt_version(), '6.8.0') < 0) + assert_istrue(isprop(qobj, 'z')); + assert_isequal(qobj.z, 0); + else + assert_isfalse(isprop(qobj, 'z')); + qobj.z = 1; + assert_istrue(isprop(qobj, 'z')); + end end %============================================================================= delete(qobj);