【发布时间】:2018-03-21 09:38:37
【问题描述】:
我已阅读 QIODevice 文档,但仍不知道如何存档。 我想做的是创建一个派生自 QIODevice 的 KeyBoard 类。打开 /dev/input/eventX。我希望我的代码可以使用 KeyBoard 的 readyRead() 信号。 (QFile 不会发出 readyRead() 信号)
class KeyBoard : public QIODevice {
public:
KeyBoard();
~KeyBoard();
protected:
qint64 readData(char *data, qint64 size);
qint64 writeData(const char *data, qint64 size);
};
我需要在 readData() 和 writeData() 中做什么? 我的代码如何使用这个类? (我只使用 QCoreApplication,没有 gui)
【问题讨论】:
标签: qt