magpie/qml/Components/IconPicker.qml

45 lines
963 B
QML
Raw Normal View History

2024-04-02 01:45:48 +00:00
// 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"]
2024-04-02 01:45:48 +00:00
delegate: MenuItem {
required property string modelData
required property int index
width: parent.width
highlighted: box.highlightedIndex === index
contentItem: View {
icon: modelData
}
}
contentItem: View {
2024-04-05 16:17:24 +00:00
icon: box.icon
2024-04-02 01:45:48 +00:00
padding: 5
}
2024-04-05 16:17:24 +00:00
onActivated: index => box.icon = model[index]
2024-04-02 01:45:48 +00:00
component View: Row {
required property string icon
spacing: 5
Icon {
2024-04-02 01:45:48 +00:00
anchors.verticalCenter: parent.verticalCenter
iconName: icon
2024-04-02 01:45:48 +00:00
color: palette.text
}
Label {
anchors.verticalCenter: parent.verticalCenter
text: icon
}
}
}