[app] Improve plugin config delegates

Add description and make them more consistent with other list items in
KDE.
This commit is contained in:
Nicolas Fella 2020-11-16 00:39:23 +01:00
parent 753b1a2b0c
commit 473b1f07c3
3 changed files with 33 additions and 6 deletions

View file

@ -25,11 +25,34 @@ Kirigami.ScrollablePage
delegate: Kirigami.SwipeListItem {
CheckBox {
checked: isChecked
text: name
onClicked: {
isChecked = checked
RowLayout {
CheckBox {
id: serviceCheck
Layout.alignment: Qt.AlignVCenter
checked: model.isChecked
onToggled: model.isChecked = checked
}
ColumnLayout {
spacing: 0
Layout.fillWidth: true
Layout.alignment: Qt.AlignVCenter
Label {
Layout.fillWidth: true
text: model.name
color: listItem.pressed ? listItem.activeTextColor : listItem.textColor
elide: Text.ElideRight
}
Label {
Layout.fillWidth: true
text: model.description
color: listItem.pressed ? listItem.activeTextColor : listItem.textColor
elide: Text.ElideRight
font: Kirigami.Theme.smallFont
opacity: 0.7
}
}
}

View file

@ -68,6 +68,8 @@ QVariant PluginModel::data(const QModelIndex &index, int role) const
return QUrl::fromLocalFile(configFile);
}
case DescriptionRole:
return pluginEntry.description();
default:
return QVariant();
}
@ -82,6 +84,7 @@ QHash<int, QByteArray> PluginModel::roleNames() const
roles[IconRole] = "iconName";
roles[IdRole] = "pluginId";
roles[ConfigSourceRole] = "configSource";
roles[DescriptionRole] = "description";
return roles;
}

View file

@ -25,7 +25,8 @@ public:
enum ExtraRoles {
IconRole = Qt::UserRole + 1,
IdRole,
ConfigSourceRole
ConfigSourceRole,
DescriptionRole,
};
Q_ENUM(ExtraRoles)