Fixes for Qt 6.4.3 on Windows

This commit is contained in:
Adam Lamar 2024-12-19 15:54:50 -07:00
parent 0629cc48ea
commit 72f973774a
2 changed files with 18 additions and 7 deletions

View File

@ -9,6 +9,10 @@ QT += webenginewidgets webchannel
QT += printsupport
qtHaveModule(texttospeech): QT += texttospeech
win32 {
QT += gui-private
}
# Avoid stripping incompatible files, due to false identification as executables, on WSL
DETECT_WSL = $$system(test -f /proc/sys/fs/binfmt_misc/WSLInterop && echo true || echo false)
equals(DETECT_WSL , "true"): CONFIG += nostrip

View File

@ -15,8 +15,13 @@
#include <QPrintDialog>
#include <thread>
#include <QMessageBox>
#if defined(Q_OS_WIN) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#if defined(Q_OS_WIN)
#include <QWindow>
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#include <QtPlatformHeaders\QWindowsWindowFunctions>
#else
#include <qpa/qplatformwindow_p.h>
#endif
#endif
const QString DEFAULT_SAVE_DIR = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
@ -95,12 +100,14 @@ void KiwixApp::init()
#ifdef Q_OS_WIN
QWindow *window = mp_mainWindow->windowHandle();
if (window) {
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QWindowsWindowFunctions::setHasBorderInFullScreen(window, true);
#else
HWND handle = reinterpret_cast<HWND>(window->winId());
SetWindowLongPtr(handle, GWL_STYLE, GetWindowLongPtr(handle, GWL_STYLE) | WS_BORDER);
#endif
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QWindowsWindowFunctions::setHasBorderInFullScreen(window, true);
#else
auto nativeWindow = window->nativeInterface<QNativeInterface::Private::QWindowsWindow>();
if (nativeWindow) {
nativeWindow->setHasBorderInFullScreen(true);
}
#endif
}
#endif
connect(this, &QtSingleApplication::messageReceived, this, [=](const QString &message) {