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:
Christoph Wolk 2024-08-08 13:37:32 +02:00 committed by Aleix Pol Gonzalez
parent 9f34092aa9
commit eecdc67074

View file

@ -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 {