From: Steinar H. Gunderson Date: Wed, 3 May 2023 16:32:15 +0000 (+0200) Subject: Nicer alignment of the player table. X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=11468299cd404200de029c82e7274d2dd08bd99f;p=pkanalytics Nicer alignment of the player table. --- diff --git a/players.cpp b/players.cpp index 21e9bdf..1854408 100644 --- a/players.cpp +++ b/players.cpp @@ -35,6 +35,15 @@ QVariant PlayersModel::headerData(int section, Qt::Orientation orientation, int QVariant PlayersModel::data(const QModelIndex &index, int role) const { + if (role == Qt::TextAlignmentRole) { + if (index.column() == 0) { + return (Qt::AlignHCenter | Qt::AlignVCenter).toInt(); + } else if (index.column() == 1) { + return (Qt::AlignHCenter | Qt::AlignVCenter).toInt(); + } else { + return (Qt::AlignLeft | Qt::AlignVCenter).toInt(); + } + } if (role != Qt::DisplayRole) { return QVariant(); }