I wrote a char device driver and am now writing a QT \"wrapper\" which part of it is to get a signal to fire when the device becomes readable via the poll mechanism. I had
I'll also mention that QSocketNotifier can be used to watch stdin using the following
#include "ConsoleReader.h"
#include
#include //Provides STDIN_FILENO
ConsoleReader::ConsoleReader(QObject *parent) :
QObject(parent),
notifier(STDIN_FILENO, QSocketNotifier::Read)
{
connect(¬ifier, SIGNAL(activated(int)), this, SLOT(text()));
}
void ConsoleReader::text()
{
QTextStream qin(stdin);
QString line = qin.readLine();
emit textReceived(line);
}
---Header
#pragma once
#include
#include
class ConsoleReader : public QObject
{
Q_OBJECT
public:
explicit ConsoleReader(QObject *parent = 0);
signals:
void textReceived(QString message);
public slots:
void text();
private:
QSocketNotifier notifier;
};