Qt open file dialog box

Source: Internet
Author: User

In the project, you need to open the file dialog box and check it. I have to say that the help document of QT is very good and very detailed. There are two ways to implement this function: Use the static method of qfiledialog to instantiate the qfiledialog object.

It is basically a copy of the help document. The following is your code.

1 // click the file button 2 void firstdialog: on_pushbuttonfile_clicked () 3 {4 qstring strfile = qfiledialog: getopenfilename (5 this, 6 tr ("Open File "), 7 tr ("C: \"), 8 tr ("SQL files (*. SQL *. TXT); text files (*. TXT); all files (*. *) "); 9 UI-> lineeditfilename-> settext (strfile); 10}

The static method is very simple. If another method is not used, leave it alone.

Help document:

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.