FreeKill/qml/Pages/CardsOverview.qml

53 lines
1.1 KiB
QML
Raw Normal View History

import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import "RoomElement"
Item {
id: root
property bool loaded: false
2023-02-26 08:51:29 +00:00
ListView {
width: Math.floor(root.width / 98) * 98
height: parent.height
anchors.centerIn: parent
ScrollBar.vertical: ScrollBar {}
model: ListModel {
id: packages
}
delegate: ColumnLayout {
Text { text: Backend.translate(name) }
GridLayout {
columns: root.width / 98
Repeater {
model: JSON.parse(Backend.callLuaFunction("GetCards", [name]))
2023-02-26 08:51:29 +00:00
CardItem {
autoBack: false
Component.onCompleted: {
let data = JSON.parse(Backend.callLuaFunction("GetCardData", [modelData]));
setData(data);
}
}
}
}
}
}
Button {
text: Backend.translate("Quit")
anchors.right: parent.right
onClicked: {
mainStack.pop();
}
}
function loadPackages() {
if (loaded) return;
let packs = JSON.parse(Backend.callLuaFunction("GetAllCardPack", []));
packs.forEach((name) => packages.append({ name: name }));
loaded = true;
}
}