PDA

View Full Version : QDir::setNameFilters not working, bug?



saugumas
18th May 2008, 16:15
i tried set NameFilters:
in QDir constructor
as entryList parameter
with setNameFilters function


if i set name filter to "*.*" i see dir contents, but if i change it to, for example, "*.txt" i see no files(with entryList), i am sure there is *.txt file(s). Bug?
Is QDir name filters working for you?

I am using Qt 4.3.4, Ubuntu 8.04

thomir
19th May 2008, 20:40
Is QDir name filters working for you?

I am using Qt 4.3.4, Ubuntu 8.04

Name Filters works for me with the same Qt version and OS. Perhaps you could paste the code that you're using? Chances are you've made a mistake there...


Cheers,

saugumas
20th May 2008, 12:27
QDir Dir(DirName);
QStringList Contents, Filtering;
Filtering << "*.dat";
Contents = Dir.entryList();
//or Contents = Dir.entryList(Filtering, QDir::NoFilter, QDir::NoSort);


I see only "." and "..", but when I change filter to "*.*" I see all files. I am sure there are files with "*.dat" extension.

Bitto
20th May 2008, 19:33
Can you post compilable code that shows how you both list all files, and how you print the output that shows what this list contains? There are no known bugs in this function AFAIK.