QHostInfo::lookupHost: enable QT_NO_CONTEXTLESS_CONNECT

QHostInfo::lookupHost uses some QObject private APIs in order to have a
invoke a slot/function when the lookup is finished. The overload that
simply takes a function (and not a context object) was still available
even under QT_NO_CONTEXTLESS_CONNECT, because indeed the implementation
bypasses the public QObject::connect API. Hence, explicitly the overload
that doesn't take a context object.

Change-Id: Ibf5b0efc49b7f9c8d045862ae061f4e05ee1b769
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Giuseppe D'Angelo 2023-09-04 20:14:57 +02:00
parent c8be7c6a6c
commit 4367abb75a

View File

@ -73,12 +73,14 @@ public:
}
#endif // Q_QDOC
#ifndef QT_NO_CONTEXTLESS_CONNECT
// lookupHost to a callable (without context)
template <typename Functor>
static inline int lookupHost(const QString &name, Functor &&slot)
{
return lookupHost(name, nullptr, std::forward<Functor>(slot));
}
#endif // QT_NO_CONTEXTLESS_CONNECT
private:
QHostInfoPrivate *d_ptr;