Commit 26494998 authored by Waqar Ahmed's avatar Waqar Ahmed Committed by Christoph Cullmann
Browse files

Use switch in quickopenmodel::data

parent 99792d92
...@@ -44,26 +44,27 @@ QVariant KateQuickOpenModel::data(const QModelIndex &idx, int role) const ...@@ -44,26 +44,27 @@ QVariant KateQuickOpenModel::data(const QModelIndex &idx, int role) const
} }
const ModelEntry &entry = m_modelEntries.at(idx.row()); const ModelEntry &entry = m_modelEntries.at(idx.row());
if (role == Role::FileName) { switch (role) {
case Role::FileName:
return entry.fileName; return entry.fileName;
} else if (role == Role::FilePath) { case Role::FilePath:
return entry.filePath; return entry.filePath;
} else if (role == Qt::DisplayRole) { case Qt::FontRole: {
// Shouldn't ask for displayrole
Q_ASSERT(false);
return {};
} else if (role == Qt::FontRole) {
if (entry.bold) { if (entry.bold) {
QFont font; QFont font;
font.setBold(true); font.setBold(true);
return font; return font;
} }
} else if (role == Qt::DecorationRole) { return {};
}
case Qt::DecorationRole:
return QIcon::fromTheme(QMimeDatabase().mimeTypeForFile(entry.fileName, QMimeDatabase::MatchExtension).iconName()); return QIcon::fromTheme(QMimeDatabase().mimeTypeForFile(entry.fileName, QMimeDatabase::MatchExtension).iconName());
} else if (role == Qt::UserRole) { case Qt::UserRole:
return entry.url; return entry.url;
} else if (role == Role::Score) { case Role::Score:
return entry.score; return entry.score;
default:
return {};
} }
return {}; return {};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment