some thoughts about icons

This commit is contained in:
Blue 2024-04-01 22:45:48 -03:00
parent cf2f387f58
commit abc3ebf80a
Signed by: blue
GPG key ID: 9B203B252A63EE38
8 changed files with 166 additions and 5 deletions

View file

@ -11,6 +11,7 @@ qt_add_qml_module(magpieComponents
QML_FILES
Modal.qml
AssetLine.qml
IconPicker.qml
)
target_link_libraries(magpie PRIVATE magpieComponents)

View file

@ -0,0 +1,54 @@
// 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", "whatever"]
delegate: MenuItem {
required property string modelData
required property int index
width: parent.width
highlighted: box.highlightedIndex === index
contentItem: View {
icon: modelData
}
}
contentItem: View {
icon: currentText
padding: 5
}
component View: Row {
required property string icon
property int iconSize: 20
spacing: 5
IconImage {
id: image
anchors.verticalCenter: parent.verticalCenter
color: palette.text
source: "qrc:/icons/" + icon + ".svg"
height: parent.iconSize
width: parent.iconSize
IconImage {
id: fallback
anchors.fill: parent
source: "qrc:/icons/wallet.svg"
visible: parent.status == Image.Error
color: palette.text
}
}
Label {
anchors.verticalCenter: parent.verticalCenter
text: icon
}
}
}