Supporting data models for file lists
-
A lot of software applications will usually work with file lists.
The construction of customised data models can be performed by some design approaches then.I have got the impression that additional programming interfaces will be more helpful for this use case than a class like “QFileSystemModel”. QFileInfo objects can be combined into other data structures.
Would you like to point any information sources out for reusable class libraries in this software area?
-
It's not totally clear what you are trying to achieve.
This can be usual.
Do you want a
QFileSystemModel
that filters by extension type?Such data processing can be also useful occasionally.
But I am looking more for class libraries which will take care of the properties that are shared between files (and their names).
Examples:
- Case-insensitive iteration through file lists
- Performing an action on each element in a list
- Determination of directory hierarchies
- Development challenges around the handling of symbolic links
-
@elfring
Hi
there is http://doc.qt.io/qt-5/qfileinfo.html
for file handling. -
for file handling
I mentioned the QFileInfo class already in my clarification request.
I would appreciate if some comom file processing operations can be provided by a known class library (instead of repeating similar programming efforts). -
@elfring
well enumerating containers is covered by std so it would be few lines of code
to have a list of QFileInfo and loop over them.
Also Qt provides http://doc.qt.io/qt-5/qdiriterator.html
to handle the directories. -
@elfring said in Supporting data models for file lists:
Case-insensitive iteration through file lists
Iteration has nothing to do with case sensitivity. You can use QDirIterator
Searching can be case-insensitive using QDir::entryInfoList and passing the
QDir::CaseSensitive
filter flagPerforming an action on each element in a list
that's a for loop using
QDirIterator
there's nothing fancyDetermination of directory hierarchies
Again,
QDirIterator
can do it:iterator.fileInfo().isDir()
Development challenges around the handling of symbolic links
Just pass QDirIterator::FollowSymlinks or not. alternatively you can always use
iterator.fileInfo().isSymLink()
-