2019-04-20 22:57:40 +02:00
|
|
|
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
|
|
|
|
|
2019-04-22 12:38:23 +02:00
|
|
|
text: ""
|
|
|
|
|
|
|
|
Label {
|
|
|
|
anchors.fill: parent
|
|
|
|
anchors.leftMargin: width * 0.05
|
|
|
|
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
|
|
|
|
fontSizeMode: Text.Fit
|
|
|
|
font.bold: true
|
|
|
|
font.pixelSize: Math.abs( height * 0.4 )
|
|
|
|
minimumPixelSize: height * 0.3
|
|
|
|
|
|
|
|
elide: "ElideRight"
|
|
|
|
|
|
|
|
text: control.getText(index)
|
|
|
|
}
|
2019-04-20 22:57:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function getText(index){
|
|
|
|
|
|
|
|
// ----------------------------
|
|
|
|
// if we have registration data
|
|
|
|
|
|
|
|
var fedName // federation name
|
|
|
|
|
|
|
|
if(listData["federations"] !== undefined){
|
|
|
|
// not an international competition -> get name of federation
|
|
|
|
|
|
|
|
for(var i = 0; i < listData["federations"].length; i ++ ){
|
|
|
|
//console.log("checking " + i + ": cat: " + parseInt(listData["categorys"][i]["GrpId"]) + " searched cat: " + root.catId)
|
|
|
|
if(listData["federations"][i]["fed_id"] === listData[ root.listKey ][index]["reg_fed_id"]){
|
|
|
|
fedName = listData["federations"][i]["shortcut"]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
// an international competition -> get nation
|
|
|
|
|
|
|
|
fedName = listData[ root.listKey ][index]["nation"]
|
|
|
|
}
|
|
|
|
|
|
|
|
return listData[ "athletes" ][index]["firstname"] + " " + listData[ "athletes" ][index]["lastname"] + " (" + fedName + ")"
|
|
|
|
}
|
|
|
|
}
|