Creating File Selection Dialogs

Since we have covered the topic about message boxes, let's also learn about the other type of dialog—the File Selection Dialog. The File Selection Dialog is also very useful, especially if your application frequently deals with files. It is extremely unpleasant to ask users to key in the absolute path of the file they wanted to open, so the File Selection Dialog is very handy in this kind of situation.

Qt provides us with a built-in File Selection Dialog that looks exactly the same as the one we see in our operating system, and therefore, it won't feel unfamiliar to the users. The File Selection Dialog essentially only does one thing—it lets the user pick the file(s) or folder they want and return the path(s) ...

Get Hands-On GUI Programming with C++ and Qt5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.