magpie/qml/Components/AssetLine.qml
2024-04-09 18:04:07 -03:00

82 lines
1.9 KiB
QML

// SPDX-FileCopyrightText: 2023 Yury Gubich <blue@macaw.me>
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import magpie
Item {
id: line
required property string title
required property string icon
required property color color
required property string balance
required property string currency
required property int assetID
signal remove(id: int)
signal edit(id: int)
RowLayout {
anchors.fill: parent
spacing: 5
Rectangle {
Layout.preferredWidth: parent.height
Layout.fillHeight: true
color: line.color
Icon {
anchors.fill: parent
anchors.margins: 2
iconName: line.icon
color: pickColor(line.color)
}
}
Label {
Layout.fillHeight: true
Layout.preferredWidth: Infinity
text: title
verticalAlignment: Text.AlignVCenter
font.bold: true
}
Label {
Layout.fillHeight: true
Layout.preferredWidth: Infinity
text: balance
verticalAlignment: Text.AlignVCenter
}
Label {
Layout.fillHeight: true
Layout.preferredWidth: Infinity
text: currency
verticalAlignment: Text.AlignVCenter
}
Button {
id: editButton
Layout.fillHeight: true
text: qsTr("Edit")
icon.name: "entry-edit"
flat: true
onClicked: edit(assetID)
}
Button {
id: deleteButton
Layout.fillHeight: true
text: qsTr("Delete")
icon.name: "delete"
onClicked: remove(assetID)
palette { //unfortunately doesn't work anymore
button: "red"
}
}
}
}