#includeQFile::rename("oldfile.txt", "newfile.txt");
#include#include QString oldFilePath = QDir::homePath() + "/Documents/oldfile.txt"; QString newFilePath = QDir::homePath() + "/Documents/newfile.txt"; QFile::rename(oldFilePath, newFilePath);
#includeThese examples demonstrate how you can use QFile::rename() to rename a file. This function is part of the Qt Core library.#include bool success = QFile::rename("oldfile.txt", "newname.txt"); if(success){ qDebug() << "Rename successful!"; } else{ qDebug() << "Rename failed!"; }