From f53fa84a15a0538764bf400eb51bb403aa644f28 Mon Sep 17 00:00:00 2001 From: IChooseYou Date: Mon, 16 Feb 2026 09:06:10 -0700 Subject: [PATCH] fix: Qt5 compat - fix addAction wrapper, qHash for NodeKind, add windows-qt5 CI --- .github/workflows/build.yml | 28 ++++++++++++++++++++++++++++ src/core.h | 2 +- src/main.cpp | 8 +++++--- 3 files changed, 34 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a22408c..3f9ab09 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -173,3 +173,31 @@ jobs: files: Reclass-x86_64.AppImage env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + windows-qt5: + runs-on: windows-latest + + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Install Qt5 + uses: jurplel/install-qt-action@v4 + with: + version: '5.15.2' + arch: 'win64_msvc2019_64' + cache: true + + - uses: ilammy/msvc-dev-cmd@v1 + with: + arch: x64 + + - name: Configure + run: cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release + + - name: Build + run: cmake --build build + + - name: Test + run: ctest --test-dir build --output-on-failure --exclude-regex "test_editor|test_windbg_provider|test_com_security" diff --git a/src/core.h b/src/core.h index 80c9331..9bd37ed 100644 --- a/src/core.h +++ b/src/core.h @@ -32,7 +32,7 @@ enum class NodeKind : uint8_t { } // namespace rcx (temporarily close for qHash) #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) -inline uint qHash(rcx::NodeKind key, uint seed = 0) { return ::qHash(static_cast(key), seed); } +inline uint qHash(rcx::NodeKind key, uint seed = 0) { return qHash(static_cast(key), seed); } #endif namespace rcx { // reopen diff --git a/src/main.cpp b/src/main.cpp index d0af817..5792f97 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -357,10 +357,12 @@ QIcon MainWindow::makeIcon(const QString& svgPath) { } template < typename...Args > -inline QAction* Qt5Qt6AddAction(QWidget* parent, const QString &text, const QKeySequence &shortcut, const QIcon &icon, Args&&...args) +inline QAction* Qt5Qt6AddAction(QMenu* menu, const QString &text, const QKeySequence &shortcut, const QIcon &icon, Args&&...args) { - QAction *result = parent->addAction(icon, text, shortcut); - parent->connect(result, &QAction::triggered, std::forward(args)...); + QAction *result = menu->addAction(icon, text); + if (!shortcut.isEmpty()) + result->setShortcut(shortcut); + QObject::connect(result, &QAction::triggered, std::forward(args)...); return result; }