I have an application that copies some files, but during the copy procedure, the last modified, etc dates are changed to the current date & time. On a few forums, I see it is suggested to use the SETFILETIME call from the fileapi.h as specified here on MS docs.
However, a quick search shows these functions are available here in QFileDevice where one can use the setFileTime function with the following FileTime enum. Note, QFile or QFileInfo does not allow modifying these dates & times, only reading these dates & times.
QFileDevice::FileAccessTime 0 When the file was most recently accessed (e.g. read or written to). QFileDevice::FileBirthTime 1 When the file was created (may not be not supported on UNIX). QFileDevice::FileMetadataChangeTime 2 When the file's metadata was last changed. QFileDevice::FileModificationTime 3 When the file was most recently modified.
How can I get a instance of this QFileDevice from say a QFileInfo object or even a QFile object (in this case, QFile inherits from QFileDevice - will a e.g. static_cast<>() help?
ALternatively, should I rather use the Windows FileAPI.h - how can I do this from say some file location and a QDateTime to modify the created or lastModified time?
