diff --git a/appveyor.yml b/appveyor.yml index 605810f62d..c88dc23eaf 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: @@ -39,7 +39,7 @@ build_script: # Upload build artifacts but only for commits pushes, no pull requests. after_build: -- if defined APPVEYOR_PULL_REQUEST_NUMBER appveyor exit +#- if defined APPVEYOR_PULL_REQUEST_NUMBER appveyor exit # %APPVEYOR_BUILD_FOLDER% is the path to the git clone. - mkdir %APPVEYOR_BUILD_FOLDER% # Copy build artifacts back to the git clone dir because they can only be 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/compile_windows.bat b/frontends/qt/compile_windows.bat index 8c0f829125..463052651f 100644 --- a/frontends/qt/compile_windows.bat +++ b/frontends/qt/compile_windows.bat @@ -3,7 +3,7 @@ call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat" cd build qmake ..\BitBox.pro -nmake +nmake /d COPY "%VCToolsRedistDir%\x64\Microsoft.VC142.CRT\msvcp140.dll" windows\ COPY "%VCToolsRedistDir%\x64\Microsoft.VC142.CRT\msvcp140_1.dll" windows\ COPY "%VCToolsRedistDir%\x64\Microsoft.VC142.CRT\msvcp140_2.dll" windows\ 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).