magpie/qml/Application/Assets.qml
2024-04-09 18:04:07 -03:00

68 lines
1.3 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 Qt.labs.qmlmodels
import magpie
import magpie.Components as Components
Item {
signal add()
signal edit(id: int)
signal remove(id: int)
id: item
ColumnLayout {
id: column
anchors.fill: parent
Label {
id: label
text: "Assets"
Layout.alignment: Qt.AlignHCenter
font {
pixelSize: 24
bold: true
}
}
ListView {
id: listView
Layout.fillHeight: true
Layout.fillWidth: true
model: Magpie.assets
spacing: 5
delegate: Components.AssetLine {
height: 40
width: listView.width
onRemove: id => item.remove(id)
onEdit: id => item.edit(id)
}
}
}
Button {
anchors {
bottom: parent.bottom
right: parent.right
bottomMargin: 20
rightMargin: 20
}
onClicked: add()
width: 50
height: 50
icon {
name: "list-add"
height: 50
width: 50
}
}
}