Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qlibraryinfo.cpp
Go to the documentation of this file.
1// Copyright (C) 2021 The Qt Company Ltd.
2// Copyright (C) 2021 Intel Corporation.
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4
5#include "qdir.h"
6#include "qstringlist.h"
7#include "qfile.h"
8#if QT_CONFIG(settings)
9#include "qsettings.h"
10#endif
11#include "qlibraryinfo.h"
12#include "qlibraryinfo_p.h"
13#include "qscopedpointer.h"
14
15#include "qcoreapplication.h"
16
17#include "private/qglobal_p.h"
18#include "archdetect.cpp"
19#include "qconfig.cpp"
20
21#ifdef Q_OS_DARWIN
22# include "private/qcore_mac_p.h"
23#endif // Q_OS_DARWIN
24
25#if QT_CONFIG(relocatable) && QT_CONFIG(dlopen) && !QT_CONFIG(framework)
26# include <dlfcn.h>
27#endif
28
29#if QT_CONFIG(relocatable) && defined(Q_OS_WIN)
30# include <qt_windows.h>
31#endif
32
34
35using namespace Qt::StringLiterals;
36
37extern void qDumpCPUFeatures(); // in qsimd.cpp
38
39#if QT_CONFIG(settings)
40
41static QSettings *findConfiguration();
42
43struct QLibrarySettings
44{
45 QLibrarySettings();
46 void load();
47 bool havePaths();
48 QSettings *configuration();
49
51 bool paths;
52 bool reloadOnQAppAvailable;
53};
54Q_GLOBAL_STATIC(QLibrarySettings, qt_library_settings)
55
56QLibrarySettings::QLibrarySettings() : paths(false), reloadOnQAppAvailable(false)
57{
58 load();
59}
60
61QSettings *QLibrarySettings::configuration()
62{
63 if (reloadOnQAppAvailable && QCoreApplication::instance() != nullptr)
64 load();
65 return settings.data();
66}
67
68bool QLibrarySettings::havePaths()
69{
70 if (reloadOnQAppAvailable && QCoreApplication::instance() != nullptr)
71 load();
72 return paths;
73}
74
75void QLibrarySettings::load()
76{
77 // If we get any settings here, those won't change when the application shows up.
78 settings.reset(findConfiguration());
79 reloadOnQAppAvailable = (settings.data() == nullptr && QCoreApplication::instance() == nullptr);
80
81 if (settings) {
82 // This code needs to be in the regular library, as otherwise a qt.conf that
83 // works for qmake would break things for dynamically built Qt tools.
84 QStringList children = settings->childGroups();
85 paths = !children.contains("Platforms"_L1)
86 || children.contains("Paths"_L1);
87 }
88}
89
90static QSettings *findConfiguration()
91{
92 if (QLibraryInfoPrivate::qtconfManualPath)
93 return new QSettings(*QLibraryInfoPrivate::qtconfManualPath, QSettings::IniFormat);
94
95 QString qtconfig = QStringLiteral(":/qt/etc/qt.conf");
96 if (QFile::exists(qtconfig))
97 return new QSettings(qtconfig, QSettings::IniFormat);
98#ifdef Q_OS_DARWIN
99 CFBundleRef bundleRef = CFBundleGetMainBundle();
100 if (bundleRef) {
101 QCFType<CFURLRef> urlRef = CFBundleCopyResourceURL(bundleRef,
102 QCFString("qt.conf"_L1),
103 0,
104 0);
105 if (urlRef) {
106 QCFString path = CFURLCopyFileSystemPath(urlRef, kCFURLPOSIXPathStyle);
107 qtconfig = QDir::cleanPath(path);
108 if (QFile::exists(qtconfig))
109 return new QSettings(qtconfig, QSettings::IniFormat);
110 }
111 }
112#endif
115 qtconfig = pwd.filePath(u"qt" QT_STRINGIFY(QT_VERSION_MAJOR) ".conf"_s);
116 if (QFile::exists(qtconfig))
117 return new QSettings(qtconfig, QSettings::IniFormat);
118 qtconfig = pwd.filePath("qt.conf"_L1);
119 if (QFile::exists(qtconfig))
120 return new QSettings(qtconfig, QSettings::IniFormat);
121 }
122 return nullptr; //no luck
123}
124
125const QString *QLibraryInfoPrivate::qtconfManualPath = nullptr;
126
127QSettings *QLibraryInfoPrivate::configuration()
128{
129 QLibrarySettings *ls = qt_library_settings();
130 return ls ? ls->configuration() : nullptr;
131}
132
133void QLibraryInfoPrivate::reload()
134{
135 if (qt_library_settings.exists())
136 qt_library_settings->load();
137}
138
139static bool havePaths() {
140 QLibrarySettings *ls = qt_library_settings();
141 return ls && ls->havePaths();
142}
143
144#endif // settings
145
171QLibraryInfo::QLibraryInfo()
172{ }
173
174#if defined(Q_CC_CLANG) // must be before GNU, because clang claims to be GNU too
175# define COMPILER_STRING __VERSION__ /* already includes the compiler's name */
176#elif defined(Q_CC_GHS)
177# define COMPILER_STRING "GHS " QT_STRINGIFY(__GHS_VERSION_NUMBER)
178#elif defined(Q_CC_GNU)
179# define COMPILER_STRING "GCC " __VERSION__
180#elif defined(Q_CC_MSVC)
181# if _MSC_VER < 1910
182# define COMPILER_STRING "MSVC 2015"
183# elif _MSC_VER < 1917
184# define COMPILER_STRING "MSVC 2017"
185# elif _MSC_VER < 1930
186# define COMPILER_STRING "MSVC 2019"
187# elif _MSC_VER < 2000
188# define COMPILER_STRING "MSVC 2022"
189# else
190# define COMPILER_STRING "MSVC _MSC_VER " QT_STRINGIFY(_MSC_VER)
191# endif
192#else
193# define COMPILER_STRING "<unknown compiler>"
194#endif
195#ifdef QT_NO_DEBUG
196# define DEBUG_STRING " release"
197#else
198# define DEBUG_STRING " debug"
199#endif
200#ifdef QT_SHARED
201# define SHARED_STRING " shared (dynamic)"
202#else
203# define SHARED_STRING " static"
204#endif
205static const char *qt_build_string() noexcept
206{
207 return "Qt " QT_VERSION_STR " (" ARCH_FULL SHARED_STRING DEBUG_STRING " build; by " COMPILER_STRING ")";
208}
209
218const char *QLibraryInfo::build() noexcept
219{
220 return qt_build_string();
221}
222
228bool
230{
231#ifdef QT_DEBUG
232 return true;
233#else
234 return false;
235#endif
236}
237
243{
244#ifdef QT_SHARED
245 return true;
246#else
247 return false;
248#endif
249}
250
258{
259 return QVersionNumber(QT_VERSION_MAJOR, QT_VERSION_MINOR, QT_VERSION_PATCH);
260}
261
263{
264 QString appDir;
265
267#ifdef Q_OS_DARWIN
268 CFBundleRef bundleRef = CFBundleGetMainBundle();
269 if (bundleRef) {
270 QCFType<CFURLRef> urlRef = CFBundleCopyBundleURL(bundleRef);
271 if (urlRef) {
272 QCFString path = CFURLCopyFileSystemPath(urlRef, kCFURLPOSIXPathStyle);
273#ifdef Q_OS_MACOS
274 QString bundleContentsDir = QString(path) + "/Contents/"_L1;
275 if (QDir(bundleContentsDir).exists())
276 return QDir::cleanPath(bundleContentsDir);
277#else
278 return QDir::cleanPath(QString(path)); // iOS
279#endif // Q_OS_MACOS
280 }
281 }
282#endif // Q_OS_DARWIN
283 // We make the prefix path absolute to the executable's directory.
285 } else {
286 appDir = QDir::currentPath();
287 }
288
289 return appDir;
290}
291
292#if QT_CONFIG(relocatable)
293#if !defined(QT_STATIC) && !(defined(Q_OS_DARWIN) && QT_CONFIG(framework)) \
294 && (QT_CONFIG(dlopen) || defined(Q_OS_WIN))
295static QString prefixFromQtCoreLibraryHelper(const QString &qtCoreLibraryPath)
296{
297 const QString qtCoreLibrary = QDir::fromNativeSeparators(qtCoreLibraryPath);
298 const QString libDir = QFileInfo(qtCoreLibrary).absolutePath();
299 const QString prefixDir = libDir + "/" QT_CONFIGURE_LIBLOCATION_TO_PREFIX_PATH;
300 return QDir::cleanPath(prefixDir);
301}
302#endif
303
304#if defined(Q_OS_WIN)
305static HMODULE getWindowsModuleHandle()
306{
307 HMODULE hModule = NULL;
308 GetModuleHandleEx(
309 GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
310 (LPCTSTR)&QLibraryInfo::isDebugBuild, &hModule);
311 return hModule;
312}
313#endif // Q_OS_WIN
314
315static QString getRelocatablePrefix(QLibraryInfoPrivate::UsageMode usageMode)
316{
317 QString prefixPath;
318
319 // For static builds, the prefix will be the app directory.
320 // For regular builds, the prefix will be relative to the location of the QtCore shared library.
321#if defined(QT_STATIC)
322 prefixPath = prefixFromAppDirHelper();
323 if (usageMode == QLibraryInfoPrivate::UsedFromQtBinDir) {
324 // For Qt tools in a static build, we must chop off the bin directory.
325 constexpr QByteArrayView binDir = qt_configure_strs.viewAt(QLibraryInfo::BinariesPath - 1);
326 constexpr size_t binDirLength = binDir.size() + 1;
327 prefixPath.chop(binDirLength);
328 }
329#elif defined(Q_OS_DARWIN) && QT_CONFIG(framework)
330 Q_UNUSED(usageMode);
331#ifndef QT_LIBINFIX
332 #define QT_LIBINFIX ""
333#endif
334 auto qtCoreBundle = CFBundleGetBundleWithIdentifier(CFSTR("org.qt-project.QtCore" QT_LIBINFIX));
335 if (!qtCoreBundle) {
336 // When running Qt apps over Samba shares, CoreFoundation will fail to find
337 // the Resources directory inside the bundle, This directory is a symlink,
338 // and CF relies on readdir() and dtent.dt_type to detect symlinks, which
339 // does not work reliably for Samba shares. We work around it by manually
340 // looking for the QtCore bundle.
341 auto allBundles = CFBundleGetAllBundles();
342 auto bundleCount = CFArrayGetCount(allBundles);
343 for (int i = 0; i < bundleCount; ++i) {
344 auto bundle = CFBundleRef(CFArrayGetValueAtIndex(allBundles, i));
345 auto url = QCFType<CFURLRef>(CFBundleCopyBundleURL(bundle));
346 auto path = QCFType<CFStringRef>(CFURLCopyFileSystemPath(url, kCFURLPOSIXPathStyle));
347 if (CFStringHasSuffix(path, CFSTR("/QtCore" QT_LIBINFIX ".framework"))) {
348 qtCoreBundle = bundle;
349 break;
350 }
351 }
352 }
353 Q_ASSERT(qtCoreBundle);
354
355 QCFType<CFURLRef> qtCorePath = CFBundleCopyBundleURL(qtCoreBundle);
356 Q_ASSERT(qtCorePath);
357
358 QCFType<CFURLRef> qtCorePathAbsolute = CFURLCopyAbsoluteURL(qtCorePath);
359 Q_ASSERT(qtCorePathAbsolute);
360
361 QCFType<CFURLRef> libDirCFPath = CFURLCreateCopyDeletingLastPathComponent(NULL, qtCorePathAbsolute);
362
363 const QCFString libDirCFString = CFURLCopyFileSystemPath(libDirCFPath, kCFURLPOSIXPathStyle);
364
365 const QString prefixDir = QString(libDirCFString) + "/" QT_CONFIGURE_LIBLOCATION_TO_PREFIX_PATH;
366
367 prefixPath = QDir::cleanPath(prefixDir);
368#elif QT_CONFIG(dlopen)
369 Q_UNUSED(usageMode);
370 Dl_info info;
371 int result = dladdr(reinterpret_cast<void *>(&QLibraryInfo::isDebugBuild), &info);
372 if (result > 0 && info.dli_fname)
373 prefixPath = prefixFromQtCoreLibraryHelper(QString::fromLocal8Bit(info.dli_fname));
374#elif defined(Q_OS_WIN)
375 Q_UNUSED(usageMode);
376 HMODULE hModule = getWindowsModuleHandle();
377 const int kBufferSize = 4096;
378 wchar_t buffer[kBufferSize];
379 DWORD pathSize = GetModuleFileName(hModule, buffer, kBufferSize);
380 const QString qtCoreFilePath = QString::fromWCharArray(buffer, int(pathSize));
381 const QString qtCoreDirPath = QFileInfo(qtCoreFilePath).absolutePath();
382 pathSize = GetModuleFileName(NULL, buffer, kBufferSize);
383 const QString exeDirPath = QFileInfo(QString::fromWCharArray(buffer, int(pathSize))).absolutePath();
384 if (QFileInfo(exeDirPath) == QFileInfo(qtCoreDirPath)) {
385 // QtCore DLL is next to the executable. This is either a windeployqt'ed executable or an
386 // executable within the QT_HOST_BIN directory. We're detecting the latter case by checking
387 // whether there's an import library corresponding to our QtCore DLL in PREFIX/lib.
388 const QString libdir = QString::fromLocal8Bit(
389 qt_configure_strs.viewAt(QLibraryInfo::LibrariesPath - 1));
390 const QLatin1Char slash('/');
391#if defined(Q_CC_MINGW)
392 const QString implibPrefix = QStringLiteral("lib");
393 const QString implibSuffix = QStringLiteral(".a");
394#else
395 const QString implibPrefix;
396 const QString implibSuffix = QStringLiteral(".lib");
397#endif
398 const QString qtCoreImpLibFileName = implibPrefix
399 + QFileInfo(qtCoreFilePath).completeBaseName() + implibSuffix;
400 const QString qtCoreImpLibPath = qtCoreDirPath
401 + slash + QT_CONFIGURE_LIBLOCATION_TO_PREFIX_PATH
402 + slash + libdir
403 + slash + qtCoreImpLibFileName;
404 if (!QFileInfo::exists(qtCoreImpLibPath)) {
405 // We did not find a corresponding import library and conclude that this is a
406 // windeployqt'ed executable.
407 return exeDirPath;
408 }
409 }
410 if (!qtCoreFilePath.isEmpty())
411 prefixPath = prefixFromQtCoreLibraryHelper(qtCoreFilePath);
412#else
413#error "The chosen platform / config does not support querying for a dynamic prefix."
414#endif
415
416#if defined(Q_OS_LINUX) && !defined(QT_STATIC) && defined(__GLIBC__)
417 // QTBUG-78948: libQt5Core.so may be located in subdirectories below libdir.
418 // See "Hardware capabilities" in the ld.so documentation and the Qt 5.3.0
419 // changelog regarding SSE2 support.
420 const QString libdir = QString::fromLocal8Bit(
421 qt_configure_strs.viewAt(QLibraryInfo::LibrariesPath - 1));
422 QDir prefixDir(prefixPath);
423 while (!prefixDir.exists(libdir)) {
424 prefixDir.cdUp();
425 prefixPath = prefixDir.absolutePath();
426 if (prefixDir.isRoot()) {
427 prefixPath.clear();
428 break;
429 }
430 }
431#endif
432
433 Q_ASSERT_X(!prefixPath.isEmpty(), "getRelocatablePrefix",
434 "Failed to find the Qt prefix path.");
435 return prefixPath;
436}
437#endif
438
440{
441#if QT_CONFIG(relocatable)
442 return getRelocatablePrefix(usageMode);
443#else
444 Q_UNUSED(usageMode);
445 return QString::fromLocal8Bit(QT_CONFIGURE_PREFIX_PATH);
446#endif
447}
448
450{
451 /*
452 * To add a new entry in QLibraryInfo::LibraryPath, add it to the enum
453 * in qtbase/src/corelib/global/qlibraryinfo.h and:
454 * - add its relative path in the qtConfEntries[] array below
455 * (the key is what appears in a qt.conf file)
456 */
457 static constexpr auto qtConfEntries = qOffsetStringArray(
458 "Prefix", ".",
459 "Documentation", "doc", // should be ${Data}/doc
460 "Headers", "include",
461 "Libraries", "lib",
462#ifdef Q_OS_WIN
463 "LibraryExecutables", "bin",
464#else
465 "LibraryExecutables", "libexec", // should be ${ArchData}/libexec
466#endif
467 "Binaries", "bin",
468 "Plugins", "plugins", // should be ${ArchData}/plugins
469
470 "QmlImports", "qml", // should be ${ArchData}/qml
471
472 "ArchData", ".",
473 "Data", ".",
474 "Translations", "translations", // should be ${Data}/translations
475 "Examples", "examples",
476 "Tests", "tests"
477 );
478 static constexpr QByteArrayView dot = qtConfEntries.viewAt(1);
479 static_assert(dot.size() == 1);
480 static_assert(dot[0] == '.');
481
483
484 if (int(loc) < qtConfEntries.count()) {
485 result.key = QLatin1StringView(qtConfEntries.viewAt(loc * 2));
486 result.defaultValue = QLatin1StringView(qtConfEntries.viewAt(loc * 2 + 1));
487 if (result.key == u"QmlImports")
488 result.fallbackKey = u"Qml2Imports"_s;
489#ifndef Q_OS_WIN // On Windows we use the registry
490 } else if (loc == QLibraryInfo::SettingsPath) {
491 result.key = "Settings"_L1;
492 result.defaultValue = QLatin1StringView(dot);
493#endif
494 }
495
496 return result;
497}
498
510{
512}
513
514
515/*
516 Returns the path specified by \a p.
517
518 The usage mode can be set to UsedFromQtBinDir to enable special handling for executables that
519 live in <install-prefix>/bin.
520 */
522{
523 const QLibraryInfo::LibraryPath loc = p;
524 QString ret;
525 bool fromConf = false;
526#if QT_CONFIG(settings)
527 if (havePaths()) {
528 fromConf = true;
529
531 if (!li.key.isNull()) {
532 QSettings *config = QLibraryInfoPrivate::configuration();
533 Q_ASSERT(config != nullptr);
534 config->beginGroup("Paths"_L1);
535
536 if (li.fallbackKey.isNull()) {
537 ret = config->value(li.key, li.defaultValue).toString();
538 } else {
539 QVariant v = config->value(li.key);
540 if (!v.isValid())
541 v = config->value(li.fallbackKey, li.defaultValue);
542 ret = v.toString();
543 }
544
545 qsizetype startIndex = 0;
546 while (true) {
547 startIndex = ret.indexOf(u'$', startIndex);
548 if (startIndex < 0)
549 break;
550 if (ret.size() < startIndex + 3)
551 break;
552 if (ret.at(startIndex + 1) != u'(') {
553 startIndex++;
554 continue;
555 }
556 qsizetype endIndex = ret.indexOf(u')', startIndex + 2);
557 if (endIndex < 0)
558 break;
559 auto envVarName = QStringView{ret}.mid(startIndex + 2, endIndex - startIndex - 2);
560 QString value = QString::fromLocal8Bit(qgetenv(envVarName.toLocal8Bit().constData()));
561 ret.replace(startIndex, endIndex - startIndex + 1, value);
562 startIndex += value.size();
563 }
564
565 config->endGroup();
566
568 }
569 }
570#endif // settings
571
572 if (!fromConf) {
573 if (loc == QLibraryInfo::PrefixPath) {
574 ret = getPrefix(usageMode);
575 } else if (int(loc) <= qt_configure_strs.count()) {
576 ret = QString::fromLocal8Bit(qt_configure_strs.viewAt(loc - 1));
577#ifndef Q_OS_WIN // On Windows we use the registry
578 } else if (loc == QLibraryInfo::SettingsPath) {
579 // Use of volatile is a hack to discourage compilers from calling
580 // strlen(), in the inlined fromLocal8Bit(const char *)'s body, at
581 // compile-time, as Qt installers binary-patch the path, replacing
582 // the dummy path seen at compile-time, typically changing length.
583 const char *volatile path = QT_CONFIGURE_SETTINGS_PATH;
585#endif
586 }
587 }
588
589 if (!ret.isEmpty() && QDir::isRelativePath(ret)) {
590 QString baseDir;
591 if (loc == QLibraryInfo::PrefixPath) {
592 baseDir = prefixFromAppDirHelper();
593 } else {
594 // we make any other path absolute to the prefix directory
595 baseDir = path(QLibraryInfo::PrefixPath, usageMode);
596 }
597 ret = QDir::cleanPath(baseDir + u'/' + ret);
598 }
599 return ret;
600}
601
616{
617#if QT_CONFIG(settings)
618 QScopedPointer<const QSettings> settings(findConfiguration());
619 if (!settings.isNull()) {
620 const QString key = "Platforms/"_L1
621 + platformName
622 + "Arguments"_L1;
623 return settings->value(key).toStringList();
624 }
625#else
626 Q_UNUSED(platformName);
627#endif // settings
628 return QStringList();
629}
630
684const char *qVersion() noexcept
685{
686 return QT_VERSION_STR;
687}
688
689#if QT_DEPRECATED_SINCE(6, 9)
690
691bool qSharedBuild() noexcept
692{
694}
695
696#endif // QT_DEPRECATED_SINCE(6, 9)
697
699
700#if defined(Q_CC_GNU) && defined(ELF_INTERPRETER)
701# include <elf.h>
702# include <stdio.h>
703# include <stdlib.h>
704
705#include "private/qcoreapplication_p.h"
706
707QT_WARNING_DISABLE_GCC("-Wformat-overflow")
708QT_WARNING_DISABLE_GCC("-Wattributes")
709QT_WARNING_DISABLE_CLANG("-Wattributes")
711
712# if defined(Q_OS_LINUX)
713# include "minimum-linux_p.h"
714# endif
715# ifdef QT_ELF_NOTE_OS_TYPE
716struct ElfNoteAbiTag
717{
718 static_assert(sizeof(Elf32_Nhdr) == sizeof(Elf64_Nhdr),
719 "The size of an ELF note is wrong (should be 12 bytes)");
720 struct Payload {
721 Elf32_Word ostype = QT_ELF_NOTE_OS_TYPE;
722 Elf32_Word major = QT_ELF_NOTE_OS_MAJOR;
723 Elf32_Word minor = QT_ELF_NOTE_OS_MINOR;
724# ifdef QT_ELF_NOTE_OS_PATCH
725 Elf32_Word patch = QT_ELF_NOTE_OS_PATCH;
726# endif
727 };
728
729 Elf32_Nhdr header = {
730 .n_namesz = sizeof(name),
731 .n_descsz = sizeof(Payload),
732 .n_type = NT_GNU_ABI_TAG
733 };
734 char name[sizeof ELF_NOTE_GNU] = ELF_NOTE_GNU; // yes, include the null terminator
735 Payload payload = {};
736};
737__attribute__((section(".note.ABI-tag"), aligned(4), used))
738extern constexpr ElfNoteAbiTag QT_MANGLE_NAMESPACE(qt_abi_tag) = {};
739# endif
740
741extern const char qt_core_interpreter[] __attribute__((section(".interp")))
742 = ELF_INTERPRETER;
743
744extern "C" void qt_core_boilerplate() __attribute__((force_align_arg_pointer));
745void qt_core_boilerplate()
746{
747 printf("This is the QtCore library version %s\n"
748 "Copyright (C) 2016 The Qt Company Ltd.\n"
749 "Contact: http://www.qt.io/licensing/\n"
750 "\n"
751 "Installation prefix: %s\n"
752 "Library path: %s\n"
753 "Plugin path: %s\n",
755 QT_CONFIGURE_PREFIX_PATH,
756 qt_configure_strs[QT_PREPEND_NAMESPACE(QLibraryInfo)::LibrariesPath - 1],
757 qt_configure_strs[QT_PREPEND_NAMESPACE(QLibraryInfo)::PluginsPath - 1]);
758
760
761 exit(0);
762}
763
764#endif
#define ARCH_FULL
constexpr qsizetype size() const noexcept
static QCoreApplication * instance() noexcept
Returns a pointer to the application's QCoreApplication (or QGuiApplication/QApplication) instance.
static QString applicationDirPath()
Returns the directory that contains the application executable.
\inmodule QtCore
Definition qdir.h:19
static bool isRelativePath(const QString &path)
Returns true if path is relative; returns false if it is absolute.
Definition qdir.cpp:2409
static QString fromNativeSeparators(const QString &pathName)
Definition qdir.cpp:962
static QString cleanPath(const QString &path)
Returns path with directory separators normalized (that is, platform-native separators converted to "...
Definition qdir.cpp:2395
static QString currentPath()
Returns the absolute path of the application's current directory.
Definition qdir.cpp:2051
\inmodule QtCore \reentrant
Definition qfileinfo.h:22
QString completeBaseName() const
Returns the complete base name of the file without the path.
QString absolutePath() const
Returns a file's path absolute path.
bool exists() const
Returns true if the file exists; otherwise returns false.
bool exists() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qfile.cpp:351
static QString path(QLibraryInfo::LibraryPath p, UsageMode usageMode=RegularUsage)
static LocationInfo locationInfo(QLibraryInfo::LibraryPath loc)
\inmodule QtCore
static bool isSharedBuild() noexcept Q_DECL_CONST_FUNCTION
static bool isDebugBuild() noexcept Q_DECL_CONST_FUNCTION
static QStringList platformPluginArguments(const QString &platformName)
Returns additional arguments to the platform plugin matching platformName which can be specified as a...
static QString path(LibraryPath p)
LibraryPath
\keyword library location
static QVersionNumber version() noexcept Q_DECL_CONST_FUNCTION
static const char * build() noexcept
Returns a string describing how this version of Qt was built.
\inmodule QtCore
\inmodule QtCore
Definition qsettings.h:30
QVariant value(QAnyStringView key, const QVariant &defaultValue) const
Returns the value for setting key.
QStringList childGroups() const
Returns a list of all key top-level groups that contain keys that can be read using the QSettings obj...
\inmodule QtCore
\inmodule QtCore
Definition qstringview.h:76
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
void chop(qsizetype n)
Removes n characters from the end of the string.
Definition qstring.cpp:6180
static QString fromLocal8Bit(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qstring.cpp:5788
void clear()
Clears the contents of the string and makes it null.
Definition qstring.h:1107
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition qstring.h:1083
static QString fromWCharArray(const wchar_t *string, qsizetype size=-1)
Definition qstring.h:1164
\inmodule QtCore
Definition qvariant.h:64
T value() const &
Definition qvariant.h:511
QStringList toStringList() const
Returns the variant as a QStringList if the variant has userType() \l QMetaType::QStringList,...
\inmodule QtCore
p1 load("image.bmp")
#define QT_ELF_NOTE_OS_PATCH
#define QT_ELF_NOTE_OS_TYPE
#define QT_ELF_NOTE_OS_MINOR
#define QT_ELF_NOTE_OS_MAJOR
Combined button and popup list for selecting options.
#define QT_WARNING_DISABLE_INTEL(number)
#define QT_WARNING_DISABLE_GCC(text)
#define QT_WARNING_DISABLE_CLANG(text)
static QString header(const QString &name)
EGLConfig config
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
#define Q_GLOBAL_STATIC(TYPE, NAME,...)
static const int kBufferSize
static const char * qt_build_string() noexcept
static QString getPrefix(QLibraryInfoPrivate::UsageMode usageMode)
static QString prefixFromAppDirHelper()
#define SHARED_STRING
void qDumpCPUFeatures()
Definition qsimd.cpp:623
#define COMPILER_STRING
#define DEBUG_STRING
return ret
constexpr auto qOffsetStringArray(const char(&...strings)[Nx]) noexcept
GLsizei const GLfloat * v
[13]
GLuint64 key
GLenum GLuint buffer
GLsizei const GLuint * paths
GLuint name
GLsizei const GLchar *const * path
GLuint64EXT * result
[6]
GLfloat GLfloat p
[1]
static qreal dot(const QPointF &a, const QPointF &b)
#define Q_ASSERT(cond)
Definition qrandom.cpp:47
#define Q_ASSERT_X(cond, x, msg)
Definition qrandom.cpp:48
Int aligned(Int v, Int byteAlign)
#define QStringLiteral(str)
#define QT_MANGLE_NAMESPACE(name)
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)
#define QT_STRINGIFY(x)
#define Q_UNUSED(x)
QT_BEGIN_NAMESPACE Q_CORE_EXPORT Q_DECL_CONST_FUNCTION const char * qVersion(void) Q_DECL_NOEXCEPT
ptrdiff_t qsizetype
Definition qtypes.h:70
QT_END_NAMESPACE typedef QT_PREPEND_NAMESPACE(quintptr) WId
HINSTANCE HMODULE
QString bundle
QFileInfo info(fileName)
[8]
QSettings settings("MySoft", "Star Runner")
[0]
QUrl url("example.com")
[constructor-url-reference]
\inmodule QtCore \reentrant
Definition qchar.h:17