Start: add option to show only FreeCAD native files in custom folder

This commit is contained in:
Furgo
2025-03-01 21:23:52 +01:00
parent 0c65673a6f
commit 779e1efa55
2 changed files with 8 additions and 0 deletions

View File

@@ -41,6 +41,8 @@ CustomFolderModel::CustomFolderModel(QObject* parent)
_customFolderDirectory =
QDir(QString::fromStdString(parameterGroup->GetASCII("CustomFolder", "")));
_showOnlyFCStd = parameterGroup->GetBool("ShowOnlyFCStd", false);
}
void CustomFolderModel::loadCustomFolder()
@@ -52,6 +54,11 @@ void CustomFolderModel::loadCustomFolder()
"BaseApp/Preferences/Mod/Start/CustomFolder: cannot read custom folder %s\n",
_customFolderDirectory.absolutePath().toStdString().c_str());
}
if (_showOnlyFCStd) {
_customFolderDirectory.setNameFilters(QStringList() << QStringLiteral("*.FCStd"));
}
auto entries = _customFolderDirectory.entryList(QDir::Filter::Files | QDir::Filter::Readable,
QDir::SortFlag::Name);
for (const auto& entry : entries) {

View File

@@ -46,6 +46,7 @@ public:
private:
QDir _customFolderDirectory;
bool _showOnlyFCStd; // Show only FreeCAD files
};
} // namespace Start