From 11468299cd404200de029c82e7274d2dd08bd99f Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Wed, 3 May 2023 18:32:15 +0200 Subject: [PATCH] Nicer alignment of the player table. --- players.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) 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(); } -- 2.39.2