These two lines of code are written before a TCP transfer file program:
QString FileName; Save File path
FileName = Qfiledialog::getopenfilename (This, tr ("This is title >> Open >>"), tr ("C:/qt/icon"), tr ("Pngfile" (*.png);; IconFile (*.icon); Htmfile (*.htm)));
The GetOpenFileName () static method returns the absolute path of the file selected by the user, and returns an empty string (NULL) if the user chooses to cancel in the dialog box.
Let's look at the GetOpenFileName function prototype (to return qstring for example):
QString GetOpenFileName (qwidget * parent = 0,//parameter 1: Parent form
Const QString & caption = QString (),//Parameter 2: dialog box title
Const QString & dir = QString (),//Parameter 3: Open Search Path
Const QString & filter = QString (),//Parameter 4: File filter, file type separated by a double semicolon (;; )
QString *selectedfilter = 0,
options options = 0)