From 1c0e6aaca8b7e2433816d2ef181356992246631a Mon Sep 17 00:00:00 2001 From: dorian Date: Tue, 14 May 2019 18:19:14 +0200 Subject: [PATCH] competitions are now colored in the same way as on digitalrock.de --- resources/qml/Pages/CompetitionCalendarPage.qml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/resources/qml/Pages/CompetitionCalendarPage.qml b/resources/qml/Pages/CompetitionCalendarPage.qml index d78c557..7f523d2 100644 --- a/resources/qml/Pages/CompetitionCalendarPage.qml +++ b/resources/qml/Pages/CompetitionCalendarPage.qml @@ -179,6 +179,18 @@ Page { return true } + function getCompCatData(compCatId) { + var obj = app.compCats + + for(var prop in obj) { + // go through the whole array and search for data keys + if (obj.hasOwnProperty(prop) && obj[prop]["cat_id"].indexOf(compCatId) >= 0) { + console.log("found cat: " + obj[prop]['label']) + return obj[prop] + } + } + } + DataListView { id: calendarList @@ -230,7 +242,7 @@ Page { property string name: calendarList.listData[index]["name"] property string date: calendarList.listData[index]["date_span"] property var cats: calendarList.listData[index]["cats"] - property int catId: calendarList.listData[index]["cat_id"] + property int catId: calendarList.listData[index]["cat_id"] === undefined ? 0:calendarList.listData[index]["cat_id"] property bool over property var thisData: calendarList.listData[index] @@ -263,7 +275,7 @@ Page { opacity: 0.5 - color: app.competitionCategoryColors[catId] + color: root.getCompCatData(catId) === undefined ? "white":root.getCompCatData(catId)["bgcolor"] } Column {