If the QSocketNotifier
is watching a QIODevice, then there is no functional difference between QIODevice::readyRead()
and QSocketNotifier::activated(QSocketNotifier::Read)
. For that reason, you don't need a QSocketNotifier
if you're only using QIODevice
objects.
The main use of QSocketNotifier
is to monitor a socket (or any other file descriptor) that you opened through a low-level API. You may pass it a file descriptor that is not associated to another QObject (such as a file opened through std::ifstream) and it will fire a activated()
signal when you may read from your file descriptor, which is useful since a generic file descriptor won't fire Qt signals by itself.