[SOLVED] QDir setNameFilter problem, it does not filter
I try to list only .cpp file, so I used setNameFilter but anything was changed, it still lists all files.
- QDir dir;
- QStringList filters;
- filters << "*.cpp" ;
- dir.setNameFilters(filters);
- tr("Open File"),dir.currentPath());
Where I am wrong?
2 replies
You not needed QDir for filters:
- QString text = QFileDialog::getOpenFileName(this, tr("Open File"),QDir::currentPath(), "Sources (*.cpp)");
See: http://doc.qt.nokia.com/4.7/qfiledialog.html#getOpenFileName for more examples
You must log in to post a reply. Not a member yet? Register here!


