Let's make something clear first - you can't "remove" some part in the middle of a file, you can only overwrite or truncate it. The former you do with just calling write() with new data and the latter with using QFile::resize(). So in your situation, you can either reopen the file in truncate mode:
file.
open(QFile::WriteOnly|QFile
::Truncate);
QFile file("...");
file.open(QFile::WriteOnly|QFile::Truncate);
To copy to clipboard, switch view to plain text mode
or resize the file after writing the new contents:
file.write("new contents");
file.resize(file.pos());
file.write("new contents");
file.resize(file.pos());
To copy to clipboard, switch view to plain text mode
Note that this is nothing specific to Qt - files are meant to work like that.
Bookmarks