plugins/runcommand: use ColumnLayout for ListView
The ListView displaying the configured actions currently directly uses a label that is made multi-line by including a newline. As a consequence, eliding the text does not work properly and there is a visual clash with the included action button. It also means that there is a rather pointlessly translatable string that is just there for UI logic. This change modifies the delegate to use a ColumnLayout instead, which enables correct eliding of the labels and more cleanly separates layout and content concerns.
This commit is contained in:
parent
9f34092aa9
commit
eecdc67074
1 changed files with 13 additions and 2 deletions
|
@ -5,6 +5,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import QtQuick 2.15
|
import QtQuick 2.15
|
||||||
|
import QtQuick.Layouts
|
||||||
import QtQuick.Controls 2.15 as QQC2
|
import QtQuick.Controls 2.15 as QQC2
|
||||||
import org.kde.kirigami 2.20 as Kirigami
|
import org.kde.kirigami 2.20 as Kirigami
|
||||||
import org.kde.kdeconnect 1.0
|
import org.kde.kdeconnect 1.0
|
||||||
|
@ -35,8 +36,18 @@ ListView {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|
||||||
contentItem: QQC2.Label {
|
contentItem: ColumnLayout {
|
||||||
text: i18n("%1 <br> <i>%2</i>", name, command)
|
QQC2.Label {
|
||||||
|
text: name
|
||||||
|
Layout.fillWidth: true
|
||||||
|
elide: Text.ElideRight
|
||||||
|
}
|
||||||
|
QQC2.Label {
|
||||||
|
text: command
|
||||||
|
font.italic: true
|
||||||
|
Layout.fillWidth: true
|
||||||
|
elide: Text.ElideRight
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
actions: Kirigami.Action {
|
actions: Kirigami.Action {
|
||||||
|
|
Loading…
Reference in a new issue