Skip to content

Commit

Permalink
Merge pull request #1295 from kiwix/win-qt6
Browse files Browse the repository at this point in the history
Fixes for Qt 6.4.3 on Windows
  • Loading branch information
kelson42 authored Dec 22, 2024
2 parents 0629cc4 + 72f9737 commit 41ed4f3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
4 changes: 4 additions & 0 deletions kiwix-desktop.pro
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 14 additions & 7 deletions src/kiwixapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 41ed4f3

Please sign in to comment.