magpie/qml/Components/IconPicker.qml

46 lines
984 B
QML

// SPDX-FileCopyrightText: 2023 Yury Gubich <blue@macaw.me>
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick
import QtQuick.Controls
ComboBox {
property string icon: ""
id: box
model: ["wallet", "coin", "paper"]
delegate: MenuItem {
required property string modelData
required property int index
width: parent.width
highlighted: box.highlightedIndex === index
contentItem: View {
icon: modelData
}
}
contentItem: View {
icon: box.icon
padding: 5
}
onActivated: index => box.icon = model[index]
component View: Row {
required property string icon
spacing: 5
Icon {
anchors.verticalCenter: parent.verticalCenter
iconName: icon
color: label.color
}
Label {
id: label
anchors.verticalCenter: parent.verticalCenter
text: icon
}
}
}