some thoughts about icons
This commit is contained in:
parent
cf2f387f58
commit
abc3ebf80a
8 changed files with 166 additions and 5 deletions
|
@ -11,6 +11,7 @@ qt_add_qml_module(magpieComponents
|
|||
QML_FILES
|
||||
Modal.qml
|
||||
AssetLine.qml
|
||||
IconPicker.qml
|
||||
)
|
||||
|
||||
target_link_libraries(magpie PRIVATE magpieComponents)
|
||||
|
|
54
qml/Components/IconPicker.qml
Normal file
54
qml/Components/IconPicker.qml
Normal 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
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue