[games/chessament] src: Fix sorting of byes
Manuel Alcaraz Zambrano <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit c25cf0edb4b8ff93bef4dc9cb1cdf9b9bf319f61 by Manuel Alcaraz Zambrano.
Committed on 06/08/2026 at 21:47.
Pushed by manuelal into branch 'master'.
Fix sorting of byes
M +4 -0 src/pairingmodel.cpp
M +1 -0 src/pairingmodel.h
M +1 -0 src/qml/PairingsPage.qml
https://invent.kde.org/games/chessament/-/commit/c25cf0edb4b8ff93bef4dc9cb1cdf9b9bf319f61
diff --git a/src/pairingmodel.cpp b/src/pairingmodel.cpp
index 9901937..a8f512b 100644
--- a/src/pairingmodel.cpp
+++ b/src/pairingmodel.cpp
@@ -75,6 +75,9 @@ QVariant PairingModel::data(const QModelIndex &index, int role) const
default:
return Qt::AlignTrailing;
}
+ } else if (role == PairingModel::Roles::SortValue) {
+ Q_ASSERT(column == PairingModel::Columns::Board);
+ return pairing->board();
}
return {};
@@ -88,6 +91,7 @@ QHash<int, QByteArray> PairingModel::roleNames() const
{PairingModel::Roles::PairingRole, "pairing"},
{Qt::TextAlignmentRole, "textAlignment"},
{PairingModel::Roles::EnableSort, "enableSort"},
+ {PairingModel::Roles::SortValue, "sortValue"},
};
}
diff --git a/src/pairingmodel.h b/src/pairingmodel.h
index 5056805..561a3b6 100644
--- a/src/pairingmodel.h
+++ b/src/pairingmodel.h
@@ -30,6 +30,7 @@ public:
HasFinishedRole = Qt::UserRole,
PairingRole,
EnableSort,
+ SortValue,
};
Q_ENUM(Roles)
diff --git a/src/qml/PairingsPage.qml b/src/qml/PairingsPage.qml
index f783d51..e1d1187 100644
--- a/src/qml/PairingsPage.qml
+++ b/src/qml/PairingsPage.qml
@@ -35,6 +35,7 @@ TablePage {
sortColumn: root.sortColumn
sortOrder: root.sortOrder
+ sortRoleName: "sortValue"
filterRowCallback: function (source_row, source_parent) {
if (hideFinishedAction.checked) {
const hasFinished = sourceModel.data(sourceModel.index(source_row, 0, source_parent), PairingModel.HasFinishedRole);