[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);QString text = QFileDialog::getOpenFileName(this,
tr("Open File"),dir.currentPath());@Where I am wrong?
-
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
-
It is worked, thanks