I would execute a thread that will handle I / O. You can connect the appropriate sig / slots to βcallβ the IO from the main stream to the I / O stream. You can transfer the data you need to read / write as a signal parameter. Something like that:
class FileIOThread : public QThread { public: void run(); public slots: void writeData(QByteArray &) void readData(QByteArray &) }; class MyClass { private: FileIOThread m_writerThread; signals: void sendData(QByteArray &); .... }; MyClass::MyClass() { connect(this, SIGNAL(sendData(QByteArray&)), &m_writerThread,SLOT(writeData(QByteArray&))); .... }
source share