6#ifndef QT_NO_DESKTOPSERVICES
14#include <private/qguiapplication_p.h>
17#include <qpa/qplatformservices.h>
18#include <qpa/qplatformintegration.h>
21#include <QtCore/private/qlocking_p.h>
40#if QT_VERSION < QT_VERSION_CHECK(6, 6, 0)
43 void handlerDestroyed(
QObject *handler);
50#if QT_VERSION < QT_VERSION_CHECK(6, 6, 0)
51void QOpenUrlHandlerRegistry::handlerDestroyed(
QObject *handler)
56 if (
it->receiver == handler) {
58 qWarning(
"Please call QDesktopServices::unsetUrlHandler() before destroying a "
59 "registered URL handler object.\n"
60 "Support for destroying a registered URL handler object is deprecated, "
61 "and will be removed in Qt 6.6.");
178 static bool insideOpenUrlHandler =
false;
180 if (!insideOpenUrlHandler) {
183 insideOpenUrlHandler =
true;
185 insideOpenUrlHandler =
false;
196 qWarning(
"QDesktopServices::openUrl: Please instantiate the QGuiApplication object "
198 else if (
Q_UNLIKELY(!qobject_cast<QGuiApplication *>(application)))
199 qWarning(
"QDesktopServices::openUrl: Application is not a GUI application");
204 if (!platformServices) {
205 qWarning(
"The platform plugin does not support services.");
306 h.receiver = receiver;
309#if QT_VERSION < QT_VERSION_CHECK(6, 6, 0)
311 [registry](
QObject *
obj) { registry->handlerDestroyed(obj); },
static QCoreApplication * instance() noexcept
Returns a pointer to the application's QCoreApplication (or QGuiApplication/QApplication) instance.
static void unsetUrlHandler(const QString &scheme)
Removes a previously set URL handler for the specified scheme.
static void setUrlHandler(const QString &scheme, QObject *receiver, const char *method)
Sets the handler for the given scheme to be the handler method provided by the receiver object.
static bool openUrl(const QUrl &url)
Opens the given url in the appropriate Web browser for the user's desktop environment,...
static QPlatformIntegration * platformIntegration()
bool remove(const Key &key)
Removes the item that has the key from the hash.
iterator begin()
Returns an \l{STL-style iterators}{STL-style iterator} pointing to the first item in the hash.
const_iterator constFind(const Key &key) const noexcept
const_iterator constEnd() const noexcept
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary item after the ...
iterator Iterator
Qt-style synonym for QHash::iterator.
iterator erase(const_iterator it)
iterator end() noexcept
Returns an \l{STL-style iterators}{STL-style iterator} pointing to the imaginary item after the last ...
const_iterator ConstIterator
Qt-style synonym for QHash::const_iterator.
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
void destroyed(QObject *=nullptr)
This signal is emitted immediately before the object obj is destroyed, after any instances of QPointe...
QHash< QString, Handler > HandlerHash
QOpenUrlHandlerRegistry()=default
\macro QT_RESTRICTED_CAST_FROM_ASCII
QString toLower() const &
bool isValid() const
Returns true if the URL is non-empty and valid; otherwise returns false.
QString scheme() const
Returns the scheme of the URL.
QSet< QString >::iterator it
Combined button and popup list for selecting options.
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char * method
#define Q_GLOBAL_STATIC(TYPE, NAME,...)
#define Q_ARG(Type, data)
GLfloat GLfloat GLfloat GLfloat h
QUrl url("example.com")
[constructor-url-reference]