diff --git a/appveyor.yml b/appveyor.yml index 605810f62d..7215cd36e2 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -3,7 +3,7 @@ image: Visual Studio 2019 environment: nodejs_version: "20" matrix: - - QT: C:\Qt\5.15.2\msvc2019_64 + - QT: C:\Qt\6.2\msvc2019_64 # As installed by `choco` GOROOT: C:\Program Files\Go GOPATH: C:\gopath\ @@ -19,7 +19,7 @@ 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=%QT5%\bin;C:\Qt\Tools\QtCreator\bin\;%GOROOT%\bin;C:\gopath\bin\;C:\Qt\6.2\msvc2019_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 c408298544..9ca064a2bf 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 5a50581156..9eac1475b1 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).