PDA

View Full Version : Return value when cancelling QFileDialog::getOpenFileName()?



jiapei100
19th March 2010, 13:54
Hi, all:

I'm just wondering what is the return value when canceling QFileDialog::getOpenFileName() ????

The typical example of how to use QFileDialog::getOpenFileName()
can be found at http://pepper.troll.no/s60prereleases/doc/qfiledialog.html


QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"),
"/home",
tr("Images (*.png *.xpm *.jpg)"));


It always return a value of type QString, no matter the user clicks "OK" or clicks "Cancel".

When "cancel", what is the return value? I mean, what is the value of "fileName" when the QFileDialog has been canceled ??


Best Regards
JIA

viheaho
19th March 2010, 13:59
Based on the documentation:


This is a convenience static function that returns an existing file selected by the user. If the user presses Cancel, it returns a null string.
Was this what you were asking for?