QT5 Open File dialog box brief

Source: Internet
Author: User
Tags function prototype save file


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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.