plugin/fsm: add new roles

This commit is contained in:
2 * r + 2 * t 2025-08-31 23:36:06 +10:00
parent 018a4a90b2
commit f6c9380e9b
2 changed files with 10 additions and 2 deletions

View file

@ -18,7 +18,7 @@ QVariant FileSystemModel::data(const QModelIndex& index, int role) const {
return QVariant();
}
const FileSystemEntry* file = m_entries.at(index.row());
FileSystemEntry* file = m_entries.at(index.row());
switch (role) {
case FilePathRole:
return file->path();
@ -30,6 +30,10 @@ QVariant FileSystemModel::data(const QModelIndex& index, int role) const {
return file->parentDir();
case FileSizeRole:
return file->size();
case FileIsDirRole:
return file->isDir();
case FileIsImageRole:
return file->isImage();
default:
return QVariant();
}
@ -42,6 +46,8 @@ QHash<int, QByteArray> FileSystemModel::roleNames() const {
roles[FileNameRole] = "fileName";
roles[ParentDirRole] = "parentDir";
roles[FileSizeRole] = "fileSize";
roles[FileIsDirRole] = "fileIsDir";
roles[FileIsImageRole] = "fileIsImage";
return roles;
}

View file

@ -68,7 +68,9 @@ public:
RelativeFilePathRole,
FileNameRole,
ParentDirRole,
FileSizeRole
FileSizeRole,
FileIsDirRole,
FileIsImageRole
};
enum Filter {