app/resources/qml/Components/StartlistView.qml

75 lines
2.2 KiB
QML

import QtQuick 2.0
import QtQuick.Controls 2.4
DataListView {
id: control
property var listData: ({})
model: listData[ root.listKey ] === undefined ? 0:listData[ root.listKey ].length
delegate: ItemDelegate {
id: partDel
width: parent.width
text: ""
Row {
id: partDelFirstRow
width: parent.width
height: parent.height
Label {
height: parent.height
width: parent.width * 0.1
fontSizeMode: Text.Fit
font.bold: true
font.pixelSize: Math.abs( height * 0.6 )
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
text: listData[ "participants" ][index]["start_order"]
}
Label {
height: parent.height
width: parent.width * 0.5
fontSizeMode: Text.Fit
font.bold: true
font.pixelSize: Math.abs( height * 0.45 )
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignLeft
minimumPixelSize: 1
text: listData[ "participants" ][index]["firstname"] + " " + listData[ "participants" ][index]["lastname"]
}
Label {
height: parent.height
width: parent.width * 0.3
fontSizeMode: Text.Fit
font.bold: false
font.pixelSize: Math.abs( height * 0.4 )
minimumPixelSize: height * 0.3
elide: "ElideRight"
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
text: "<html>(<a href=\"" + (listData[ "participants" ][index]["url"] === undefined ? "":listData[ "participants" ][index]["url"]).toString() + "\">" + (listData[ "display_athlete" ] === "nation" ? listData[ "participants" ][index]["nation"] : listData[ "participants" ][index]["federation"]) + "</a>)</html>"
onLinkActivated: {
Qt.openUrlExternally(link)
}
}
}
}
}