Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
windows:mingw:win64
mingw64-libqt5-qtbase
0001-Let-Qt-find-qt.conf-on-Windows-also-on-dll...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0001-Let-Qt-find-qt.conf-on-Windows-also-on-dll-path.patch of Package mingw64-libqt5-qtbase
From bbd6e1f146ee154fc242c80e7f95fe40dc91d1a6 Mon Sep 17 00:00:00 2001 From: Ralf Habacker <ralf.habacker@freenet.de> Date: Wed, 29 May 2024 08:25:36 +0200 Subject: [PATCH] Let Qt find qt.conf on Windows also on dll path --- src/corelib/global/qlibraryinfo.cpp | 41 ++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index a1558a6ab..aabf4cb00 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -180,6 +180,34 @@ void QLibrarySettings::load() } } +#ifdef Q_OS_WIN +#include <windows.h> + +QString findMe() +{ + WCHAR path[MAX_PATH]; + HMODULE handle; + if (GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, + reinterpret_cast<LPWSTR>(&findMe), &handle)) { + GetModuleFileNameW(handle, path, sizeof(path)); + return QDir::fromNativeSeparators(QString::fromUtf16(reinterpret_cast<const ushort*>(path))); + } + return QString(); +} +#endif + +QSettings *findQtConf(const QString &path) +{ + QDir pwd(path); + QString qtconfig = pwd.filePath(QLatin1String("qt5.conf")); + if (QFile::exists(qtconfig)) + return new QSettings(qtconfig, QSettings::IniFormat); + qtconfig = pwd.filePath(QLatin1String("qt.conf")); + if (QFile::exists(qtconfig)) + return new QSettings(qtconfig, QSettings::IniFormat); + return nullptr; +} + QSettings *QLibraryInfoPrivate::findConfiguration() { #ifdef QT_BUILD_QMAKE @@ -206,13 +234,15 @@ QSettings *QLibraryInfoPrivate::findConfiguration() } #endif if (QCoreApplication::instance()) { - QDir pwd(QCoreApplication::applicationDirPath()); - qtconfig = pwd.filePath(QLatin1String("qt5.conf")); - if (QFile::exists(qtconfig)) - return new QSettings(qtconfig, QSettings::IniFormat); - qtconfig = pwd.filePath(QLatin1String("qt.conf")); - if (QFile::exists(qtconfig)) - return new QSettings(qtconfig, QSettings::IniFormat); + QSettings *settings = findQtConf(QCoreApplication::applicationDirPath()); + if (settings) + return settings; +#ifdef Q_OS_WIN + QFileInfo fi(findMe()); + settings = findQtConf(fi.absolutePath()); + if (settings) + return settings; +#endif } #endif return nullptr; //no luck -- 2.44.0
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor