Most probably the target file already exists. Documentation http://doc.qt.digia.com/4.6/qfile.html#copy says:
If a file with the name
newName
already exists,copy()
returns false.
This is not an actual error condition, because it is normal for copy()
not to overwrite. Check for its existence. And when you are inspecting for file error, do it with the error enum, eg:
QFile from("fromFile");
QFile target("targetFile");
if (target.exists())
target.remove();
if (target.error() != QFile::NoError)
// remove error
from.copy(target.fileName());
if (from.error() != QFile::NoError)
// copy error