How do I load all files in a resource directory in one method
Unsolved
QML and Qt Quick
-
I have a list of files and I couldn't be bothered to get all of their names and what I really want is to be able to load all of them into a canvas.
-
@AI_Messiah born three days ago and already posing questions...
You may want to read about QDir::entryList()
A resource directory is to be treated like any other directory, just with a ":" in front of the path.
// Specify directory with leading ":" QDir myDir(":/yourResourceRoot/yourDir"); // Specify selection criteria (empty list if you want all files) const QStringList sel = QStringList({"*.csv", "*.xlsx"}); // read files (and ignore directories) that match selection criteria QStringList files = myDir.entryList(sel,QDir::Files); // iterate through file list foreach(QString filename, files) { // process individual file }
-
@AxelVienna said in How do I load all files in a resource directory in one method:
I thought there would be a way to do it in Javascript. I didn't expect to have to do it in C++.
-
@AI_Messiah
from QML-only via FolderListModel