[Qt-interest] QDir::entryList(const QStringList & nameFilters, Filters filters = NoFilter, SortFlags sort = NoSort) method

Constantin Makshin dinosaur-rus at users.sourceforge.net
Tue Apr 28 20:22:35 CEST 2009


AFAIK, usually the wildcard for files without extension is "*.".

On Tue, 28 Apr 2009 17:13:54 +0400, Allen, Matthew <MAllen at utcretail.com>
wrote:
>> 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

-- 
Constantin "Dinosaur" Makshin



More information about the Qt-interest-old mailing list