innocent boy
innocent boy

Reputation: 315

List the paths of a directory in an array in Qt

I am a beginner in Qt creator, so my question is how to load the path of a directory into an array, for example :

here are some directory

If I want to load all the video paths in an array by order, how can I make it? I want an array called video[ ], then video[0] is the video2017-05-03-13:54:41B in the image, then video[1] is video2017-05-03-14:01:58B etc. And then show the paths in a label or a listWidget.

Upvotes: 1

Views: 383

Answers (1)

JLev
JLev

Reputation: 705

QDir recoredDir(path);
QStringList dirs = recoredDir.entryList(QDir::NoDotAndDotDot
                                                   | QDir::Dirs);

This will get you all the directories in path to the list 'dirs'

Upvotes: 3

Related Questions