4#define BUILDING_QSOCKETNOTIFIER
6#undef BUILDING_QSOCKETNOTIFIER
8#include "qplatformdefs.h"
16#include <private/qthread_p.h>
18#include <QtCore/QLoggingCategory>
19#include <QtCore/qpointer.h>
35 bool snenabled =
false;
128 qRegisterMetaType<QSocketDescriptor>();
129 qRegisterMetaType<QSocketNotifier::Type>();
155 auto thisThreadData =
d->threadData.loadRelaxed();
157 if (!
d->sockfd.isValid())
158 qWarning(
"QSocketNotifier: Invalid socket specified");
159 else if (!thisThreadData->hasEventDispatcher())
160 qWarning(
"QSocketNotifier: Can only be used with threads started with QThread");
162 thisThreadData->eventDispatcher.loadRelaxed()->registerSocketNotifier(
this);
254 return d->sockfd.isValid();
286 if (!
d->sockfd.isValid())
293 auto thisThreadData =
d->threadData.loadRelaxed();
295 if (!thisThreadData->hasEventDispatcher())
298 qWarning(
"QSocketNotifier: Socket notifiers cannot be enabled or disabled from another thread");
302 thisThreadData->eventDispatcher.loadRelaxed()->registerSocketNotifier(
this);
304 thisThreadData->eventDispatcher.loadRelaxed()->unregisterSocketNotifier(
this);
319 Q_ARG(
bool,
d->snenabled));
326 QPointer<QSocketNotifier> alive(
this);
385#include "moc_qsocketnotifier.cpp"
Type type() const
Returns the event type.
virtual bool event(QEvent *event)
This virtual function receives events to an object and should return true if the event e was recogniz...
QThread * thread() const
Returns the thread in which the object lives.
QSocketNotifier::Type sntype
void setSocket(qintptr socket)
bool isEnabled() const
Returns true if the notifier is enabled; otherwise returns false.
void activated(QSocketDescriptor socket, QSocketNotifier::Type activationEvent, QPrivateSignal)
Type type() const
Returns the socket event type specified to the constructor.
void setEnabled(bool)
If enable is true, the notifier is enabled; otherwise the notifier is disabled.
Type
This enum describes the various types of events that a socket notifier can recognize.
~QSocketNotifier()
Destroys this socket notifier.
qintptr socket() const
Returns the socket identifier assigned to this object.
QSocketNotifier(Type, QObject *parent=nullptr)
bool event(QEvent *) override
\reimp
static QThread * currentThread()
Combined button and popup list for selecting options.
#define Q_LOGGING_CATEGORY(name,...)
#define Q_DECLARE_LOGGING_CATEGORY(name)
#define Q_ARG(Type, data)