Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.
How to use QDir and QFileDialog in Qt
This code snippets shows how to get a list of files from a given directory and how to use QFileDialog to select directories. The method QDir::entryList() returns a list of the names of all the files and directories in the directory. QFileDialog::getExistingDirectory() will return an existing directory selected by the user, this dialog can allow you to select directory of your choice.
This snippet can be self-signed as it does not use any API which require developer/certified signing.
int main(int argc, char *argv)
QApplication a(argc, argv);
class MainWindow : public QMainWindow
MainWindow(QWidget *parent = 0);
#endif // MAINWINDOW_H
/*get list of file from given directory and the append it to listWidget */
The code snippet is expected to show get a list of files in a given directory.
- The Code Example will show how to get list of files from given directory and is tested on Nokia 5800 XpressMusic.