![]() Certain I/O operations, however, don't work well with a buffer. Buffering makes functions like getChar() and putChar() fast, as they can operate on the memory buffer instead of directly on the device itself. This reduces the number of required device accessing calls, which are often very slow. Some subclasses, such as QFile and QTcpSocket, are implemented using a memory buffer for intermediate storing of data. QIODevice also handles access control for you, so you can safely assume that the device is opened in write mode if writeData() is called. QIODevice uses these functions to implement all its convenience functions, such as getChar(), readLine() and write(). Subclasses of QIODevice are only required to implement the protected readData() and writeData() functions. start( "gzip", QStringList() < < "-c") īy subclassing QIODevice, you can provide the same interface to your own I/O devices. For example, QProcess has a function called waitForStarted() which suspends operation in the calling thread until the process has started.Ĭalling these functions from the main, GUI thread, may cause your user interface to freeze.
0 Comments
Leave a Reply. |