mirror of
https://github.com/nextcloud/desktop.git
synced 2024-10-25 05:45:42 +03:00
Implement FileTagModel QAbstractListModel methods
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
parent
9cc241bf96
commit
49b5fb32f9
1 changed files with 11 additions and 7 deletions
|
@ -32,21 +32,25 @@ FileTagModel::FileTagModel(const QString &serverRelativePath,
|
||||||
|
|
||||||
int FileTagModel::rowCount(const QModelIndex &parent) const
|
int FileTagModel::rowCount(const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
// For list models only the root node (an invalid parent) should return the list's size. For all
|
if (parent.isValid()) {
|
||||||
// other (valid) parents, rowCount() should return 0 so that it does not become a tree model.
|
|
||||||
if (parent.isValid())
|
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// FIXME: Implement me!
|
return _tags.count();
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant FileTagModel::data(const QModelIndex &index, int role) const
|
QVariant FileTagModel::data(const QModelIndex &index, int role) const
|
||||||
{
|
{
|
||||||
if (!index.isValid())
|
if (!index.isValid()) {
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
}
|
||||||
|
|
||||||
// FIXME: Implement me!
|
switch (role) {
|
||||||
return QVariant();
|
case Qt::DisplayRole:
|
||||||
|
return _tags.at(index.row());
|
||||||
|
default:
|
||||||
|
return QVariant();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileTagModel::fetchFileTags()
|
void FileTagModel::fetchFileTags()
|
||||||
|
|
Loading…
Reference in a new issue