6#include <QtCore/qlatin1stringview.h>
8#include <QtCore/qlibrary.h>
9#include <QtCore/private/qlocking_p.h>
11#include <QtCore/qmutex.h>
19#if !defined QT_LINKED_LIBDBUS
22Q_CONSTINIT
static QLibrary *qdbus_libdbus =
nullptr;
24void qdbus_unloadLibDBus()
28 qdbus_libdbus->
resolve(
"dbus_shutdown")();
29 qdbus_libdbus->unload();
32 qdbus_libdbus =
nullptr;
39#ifdef QT_BUILD_INTERNAL
45 Q_CONSTINIT
static bool triedToLoadLibrary =
false;
47 const auto locker = qt_scoped_lock(
mutex);
50 if (triedToLoadLibrary)
55 triedToLoadLibrary =
true;
57 static constexpr int majorversions[] = { 3, 2, -1 };
66 for (
const int majorversion : majorversions) {
67 for (
const QString &baseName : baseNames) {
70 if (majorversion != -1)
76 if (lib->
load() && lib->
resolve(
"dbus_connection_open_private"))
95 return qdbus_libdbus->resolve(
name);
104#if QT_CONFIG(library)
106 qFatal(
"Cannot find libdbus-1 in your system to resolve symbol '%s'.",
name);
108 QFunctionPointer
ptr = qdbus_libdbus->resolve(
name);
110 qFatal(
"Cannot resolve '%s' in your libdbus-1.",
name);
120static void qdbus_unloadLibDBus()
128#if defined(QT_LINKED_LIBDBUS) || QT_CONFIG(library)
129Q_DESTRUCTOR_FUNCTION(qdbus_unloadLibDBus)
\inmodule QtCore \reentrant
bool load()
Loads the library and returns true if the library was loaded successfully; otherwise returns false.
@ ExportExternalSymbolsHint
void setFileNameAndVersion(const QString &fileName, int verNum)
Sets the fileName property and major version number to fileName and versionNumber respectively.
void setFileName(const QString &fileName)
bool isLoaded() const
Returns true if load() succeeded; otherwise returns false.
bool unload()
Unloads the library and returns true if the library could be unloaded; otherwise returns false.
void setLoadHints(LoadHints hints)
QFunctionPointer resolve(const char *symbol)
Returns the address of the exported symbol symbol.
\macro QT_RESTRICTED_CAST_FROM_ASCII
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Combined button and popup list for selecting options.
QFunctionPointer qdbus_resolve_conditionally(const char *name)
QFunctionPointer qdbus_resolve_me(const char *name)
static ControlElement< T > * ptr(QWidget *widget)
Q_CORE_EXPORT bool qEnvironmentVariableIsEmpty(const char *varName) noexcept
Q_CORE_EXPORT bool qEnvironmentVariableIsSet(const char *varName) noexcept