[PATCH] Switch some columns to right alignment in divelist

Anton Lundin glance at acc.umu.se
Wed Sep 3 13:23:39 PDT 2014


Some columns in the dive list makes more sense to have right aligned
than left aligned. This switches the numeric columns to right alignment
so they is more easily compared visually.

Signed-off-by: Anton Lundin <glance at acc.umu.se>
---
 qt-ui/models.cpp | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp
index 5266130..872f395 100644
--- a/qt-ui/models.cpp
+++ b/qt-ui/models.cpp
@@ -1070,7 +1070,26 @@ QVariant DiveItem::data(int column, int role) const
 
 	switch (role) {
 	case Qt::TextAlignmentRole:
-		retVal = int(Qt::AlignLeft | Qt::AlignVCenter);
+		switch (column) {
+		case NR:
+		case DEPTH:
+		case DURATION:
+		case TEMPERATURE:
+		case TOTALWEIGHT:
+		case SAC:
+		case OTU:
+		case MAXCNS:
+			retVal = int(Qt::AlignRight | Qt::AlignVCenter);
+			break;
+		case DATE:
+		case RATING:
+		case SUIT:
+		case CYLINDER:
+		case GAS:
+		case LOCATION:
+			retVal = int(Qt::AlignLeft | Qt::AlignVCenter);
+			break;
+		}
 		break;
 	case DiveTripModel::SORT_ROLE:
 		Q_ASSERT(dive != NULL);
-- 
1.9.1



More information about the subsurface mailing list