PDA

View Full Version : open file browser and save file



mastercl
11th July 2016, 11:14
Hi all,

I'm new to QT and I found this function in qt:

QFileDialog::getSaveFileName

But it is only save file name only, not data.

May i know is there any function to let user open file browser to choose the file location and save images?

anda_skoa
11th July 2016, 12:42
1) get the file name to save to
2) save the image using that file name

Cheers,
_

weiweiqiao
13th July 2016, 02:46
Maybe you could follow these steps:
1) get the file name with path by QFileDialog::getSaveFileName. (only get the file name you wanting, no file data)
2) use image.save method

QString path = QFileDialog::getSaveFileName(0,
tr("Save File"),
".");
QImage image("no1.jpg");

image.save(path);