[Qt-interest] QDir::entryList(const QStringList & nameFilters, Filters filters = NoFilter, SortFlags sort = NoSort) method
Allen, Matthew
MAllen at utcretail.com
Tue Apr 28 15:13:54 CEST 2009
>From the QDir information online you can use name filters to find some of this information.
QStringList filters;
filters << "*.cpp" << "*.cxx" << "*.cc";
dir.setNameFilters(filters);
So you could use *.dcm instead of the above. However, with just ? and *, I'm not sure how you could do a 1 as a filename. If you could do a qregexp then you could do something simple with QRegExp("^\d+$"). So that means, one or more digits between the start and end of the string. But I'm not sure if you can do regexp in name filtering.
Worst case though you can get the list and discard things afterwards by checking against the regexp.
________________________________
From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] On Behalf Of Ahmed Khaled
Sent: Tuesday, April 28, 2009 3:33 AM
To: qt-interest at trolltech.com
Subject: [Qt-interest] QDir::entryList(const QStringList & nameFilters, Filters filters = NoFilter, SortFlags sort = NoSort) method
hello:
i wonder if there any way to filter files that doesn't have extension using the QDir::entryList<qdir.html#entryList> ( const QStringList & nameFilters, Filters filters = NoFilter, SortFlags sort = NoSort ) const
i am dealing with medical images(Dicom) that can be written as (1.dcm or 1 only ) and some times there is another file in the same folder that i am not interested in like*.ini files and the *.cng files and so on.
illustration:
QStringList filters;
QStringList files;
filters<<"*";// this filter returns all files in aGiven folder what i want is to get the dcm files and the file with no extension only as i said bfore
(files) << (QDir(folders[j])).entryList( filters,QDir::Files, QDir::Name );
and thanks for your interset
best regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090428/b7d676ad/attachment.html
More information about the Qt-interest-old
mailing list