PDA

View Full Version : copy the file from the filedialog and paste into into a different directory



kulsekarr
30th January 2015, 11:30
Hi,

i just want to copy a csv file from source- desktop(example)(the file is free from all the permissions) by selecting the file from the selection window using QFileDialog the file selected must be copied into a new location(directory) after clicking the Ok button from the file dialog.

Any one please let me know how to proceed with it. ica just able to open the file dialog and select the file.

Thanks in advance.

anda_skoa
30th January 2015, 14:00
QFile::copy().

Cheers,
_

Radek
30th January 2015, 17:56
Please, read the documentation first. As anda_skoa has noticed, copying files: QFile::copy(). As to the dialogs, there are predefined dialogs QFileDialog::getOpenFileName() and QFileDialog::getSavedFileName(). The dialogs are static methods of QFileDialog, you don't need to add anything, just call them.