From 43961bf3a350c62508daf8dd775fd32a9f524b14 Mon Sep 17 00:00:00 2001 From: Michael Ehrenreich Date: Sun, 19 Feb 2023 04:37:03 +0100 Subject: [PATCH] Make EditableListView more material --- EditableListView.qml | 25 ++++++------------------- IconChooserDelegateLayout.qml | 4 ++++ 2 files changed, 10 insertions(+), 19 deletions(-) diff --git a/EditableListView.qml b/EditableListView.qml index c45d4f7..8c4517f 100644 --- a/EditableListView.qml +++ b/EditableListView.qml @@ -51,24 +51,16 @@ ColumnLayout { width: listView.width height: 45 - Rectangle { + ItemDelegate { anchors.fill: parent - - color: isCurrentItem ? - Material.color(Material.Purple) : - Material.background - radius: 0 - - Label { + contentItem: IconChooserDelegateLayout { anchors.fill: parent - //anchors.verticalCenter: parent.verticalCenter - id: text text: model[textRole] - padding: 10 - fontSizeMode: Text.VerticalFit - minimumPixelSize: 10; - font.pixelSize: 72 + // TODO + //iconSource: comboBox.getIconUrl(index) } + onClicked: listView.currentIndex = index + down: listView.currentIndex === index } Rectangle { @@ -79,11 +71,6 @@ ColumnLayout { anchors.bottom: parent.bottom visible: index !== (listView.count - 1) } - - MouseArea { - anchors.fill: parent - onClicked: listView.currentIndex = index - } } focus: true } diff --git a/IconChooserDelegateLayout.qml b/IconChooserDelegateLayout.qml index c839ad0..49da30e 100644 --- a/IconChooserDelegateLayout.qml +++ b/IconChooserDelegateLayout.qml @@ -16,7 +16,11 @@ RowLayout { fillMode: Image.PreserveAspectFit } Label { + Layout.preferredHeight: layout.height text: layout.text + verticalAlignment: Label.AlignVCenter + fontSizeMode: Text.VerticalFit + font.pixelSize: 20 } Item { Layout.fillWidth: true