diff options
author | Orangerot <purple@orangerot.dev> | 2024-08-16 23:40:38 +0200 |
---|---|---|
committer | Orangerot <purple@orangerot.dev> | 2024-08-26 11:19:38 +0200 |
commit | d0df3af583d5b5290498a288b6fc3194bee6b357 (patch) | |
tree | 71f66f1b34fa357fa85a8a2aebfa0e694ac75883 | |
parent | b672b4698c721fa6dfd5dff965e08059d51bddda (diff) |
fix(EventInfoPage): show comptitor statistics
-rw-r--r-- | res/gui/EventInfoPage.qml | 30 | ||||
-rw-r--r-- | res/gui/EventsPage.qml | 2 | ||||
-rw-r--r-- | src/model/SportModel.cpp | 2 |
3 files changed, 22 insertions, 12 deletions
diff --git a/res/gui/EventInfoPage.qml b/res/gui/EventInfoPage.qml index 6c46a7f..2934931 100644 --- a/res/gui/EventInfoPage.qml +++ b/res/gui/EventInfoPage.qml @@ -4,8 +4,8 @@ import QtQuick.Controls Page { id: root - property string eventName - property list<QtObject> competitors + required property string eventName + required property list<QtObject> competitors header: ToolBar { ToolButton { @@ -31,17 +31,27 @@ Page { bottomMargin: 48 rightMargin: 48 spacing: 20 - model: eventName + model: competitors delegate: ItemDelegate { - text: "sadly not working..." + required property string name + required property string noc + required property string mark + required property string statistic + required property string gold + required property string silver + required property string bronze width: listView.width - listView.leftMargin - listView.rightMargin - height: avatar.implicitHeight + 32 - leftPadding: avatar.implicitWidth + 32 - - Image { - id: avatar - // source: "images/" + modelData.replace(" ", "_") + ".png" + height: 32 + Text { + anchors.left: parent.left + text: name + " (" + noc + ")" + } + Text { + anchors.right: parent.right + horizontalAlignment: Text.AlignRight + text: mark + " " + statistic + " | " + gold + "🥇 " + silver + "🥈 " + bronze + "🥉" } + } } diff --git a/res/gui/EventsPage.qml b/res/gui/EventsPage.qml index d21b5bb..c3d05f3 100644 --- a/res/gui/EventsPage.qml +++ b/res/gui/EventsPage.qml @@ -254,7 +254,7 @@ Page { model: filter delegate: ItemDelegate { required property string eventName - property list<QtObject> competitors + required property list<QtObject> competitors text: eventName width: listView.width - listView.leftMargin - listView.rightMargin height: avatar.height diff --git a/src/model/SportModel.cpp b/src/model/SportModel.cpp index 557affe..0a99c55 100644 --- a/src/model/SportModel.cpp +++ b/src/model/SportModel.cpp @@ -101,9 +101,9 @@ void SportModel::parseData() { Competitor *comp = new Competitor(this); comp->setCompetitor(competitor.toObject()); if (medals.find(comp->name()) != medals.end()) comp->setMedals(medals.find(comp->name())->second); - if (!competitors.empty()) comp->setStatistic(competitors.first()->mark()); competitors << comp; } + addRelativeToFirst(competitors); event->setCompetitors(competitors); qDebug() << entry["eventUnitName"].toString(); |