magpie/qml/Application/Assets.qml

68 lines
1.3 KiB
QML
Raw Permalink Normal View History

// SPDX-FileCopyrightText: 2023 Yury Gubich <blue@macaw.me>
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick
import QtQuick.Controls
2024-01-18 22:14:33 +00:00
import QtQuick.Layouts
2024-04-08 22:46:26 +00:00
import Qt.labs.qmlmodels
2024-01-20 21:17:21 +00:00
import magpie
2024-01-18 22:14:33 +00:00
import magpie.Components as Components
2024-01-17 21:57:34 +00:00
Item {
signal add()
signal edit(id: int)
signal remove(id: int)
id: item
2024-01-17 21:57:34 +00:00
2024-01-18 22:14:33 +00:00
ColumnLayout {
id: column
2024-01-17 21:57:34 +00:00
anchors.fill: parent
Label {
2024-01-18 22:14:33 +00:00
id: label
2024-04-08 22:46:26 +00:00
text: "Assets"
Layout.alignment: Qt.AlignHCenter
2024-01-17 21:57:34 +00:00
font {
pixelSize: 24
bold: true
}
}
ListView {
2024-01-18 22:14:33 +00:00
id: listView
Layout.fillHeight: true
Layout.fillWidth: true
2024-01-20 21:17:21 +00:00
model: Magpie.assets
spacing: 5
2024-04-08 22:46:26 +00:00
2024-01-18 22:14:33 +00:00
delegate: Components.AssetLine {
2024-04-08 22:46:26 +00:00
height: 40
2024-01-20 21:17:21 +00:00
width: listView.width
onRemove: id => item.remove(id)
onEdit: id => item.edit(id)
2024-01-17 21:57:34 +00:00
}
}
}
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
}
}
}