diff --git a/appveyor.yml b/appveyor.yml index 605810f62d..6ac4069298 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -3,23 +3,25 @@ image: Visual Studio 2019 environment: nodejs_version: "20" matrix: - - QT: C:\Qt\5.15.2\msvc2019_64 # As installed by `choco` - GOROOT: C:\Program Files\Go + - GOROOT: C:\Program Files\Go GOPATH: C:\gopath\ GOTOOLCHAIN: local PLATFORM: amd64 - COMPILER: msvc + PYTHON: C:\Python312 install: - ps: Install-Product node $env:nodejs_version + - choco install python --version=3.12.6 + - python -m pip install aqtinstall + - aqt install-qt windows desktop 6.2.4 win64_mingw -m qtpositioning qtserialport qtwebchannel qtwebengine - git submodule update --init --recursive matrix: fast_finish: true before_build: - - set PATH=%QT5%\bin;C:\Qt\Tools\QtCreator\bin\;%GOROOT%\bin;C:\gopath\bin\;C:\Qt\5.15.2\msvc2019_64\bin\;C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin;C:\MinGW\bin;%PATH% + - set PATH=C:\Qt\Tools\QtCreator\bin\;%GOROOT%\bin;C:\gopath\bin\;C:\Qt\6.2.4\mingw_64\bin\;C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin;C:\MinGW\bin;%PATH% - set MINGW_BIN=/c/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin build_script: diff --git a/frontends/qt/BitBox.pro b/frontends/qt/BitBox.pro index 79400f65ac..2fe142d008 100644 --- a/frontends/qt/BitBox.pro +++ b/frontends/qt/BitBox.pro @@ -6,6 +6,11 @@ QT += core gui QT += webenginewidgets +win32 { + # For setting 'AlwaysActivate', see. + # See https://forum.qt.io/topic/133694/using-alwaysactivatewindow-to-gain-foreground-in-win10-using-qt6-2/2 + QT += gui-private +} TARGET = BitBox TEMPLATE = app diff --git a/frontends/qt/main.cpp b/frontends/qt/main.cpp index 9914d82245..07bfcad564 100644 --- a/frontends/qt/main.cpp +++ b/frontends/qt/main.cpp @@ -33,8 +33,12 @@ #include #include #if defined(_WIN32) +#if QT_VERSION_MAJOR >= 6 +#include +#else #include #endif +#endif #include #include @@ -401,7 +405,15 @@ int main(int argc, char *argv[]) #if defined(_WIN32) // Allow existing app to be brought to the foreground. See `view->activateWindow()` above. // Without this, on Windows, only the taskbar entry would light up. +#if QT_VERSION_MAJOR >= 6 + // See See https://forum.qt.io/topic/133694/using-alwaysactivatewindow-to-gain-foreground-in-win10-using-qt6-2/2 + // Later Qt versions may expose this API again officially. https://www.qt.io/blog/platform-apis-in-qt-6. + if (auto inf = a.nativeInterface()) { + inf->setWindowActivationBehavior(QNativeInterface::Private::QWindowsApplication::AlwaysActivateWindow); + } +#else QWindowsWindowFunctions::setWindowActivationBehavior(QWindowsWindowFunctions::AlwaysActivateWindow); +#endif #endif // Receive and handle an URI sent by a secondary instance (see above).