Important: Please read the Qt Code of Conduct -

QTextStream and transactions

  • Why does not QTextStream support transactions and, hence, the managment of fragmentation, as opposed to QDataStream?

  • QDataStream only provides a convenient interface over the transaction, the actual transaction is handled by the QIODevice directly:
    You are free to use transactions with QTextStream you just need a couple more lines of code.

    • instead of dataStream.startTransaction() you would use textStream.device()->startTransaction();
    • instead of if(dataStream.commitTransaction()){/*do stuff*/} you would use:
    if(textStream.status() == QTextStream::Ok){
    /*do stuff*/

Log in to reply