[PATCH] Divelist: make the column headers for units left aligned

Dirk Hohndel dirk at hohndel.org
Thu Oct 30 10:24:58 PDT 2014


Just FYI, I had this applied yesterday and then reverted it today because
I think with my change to move the units to the tooltip I think this isn't
needed and things actually look better without it.

I know you implemented what I suggested. Thanks for that. It's just that
John's suggestion was better than mine :-)

/D

On Wed, Oct 29, 2014 at 06:23:25PM +0200, Lubomir I. Ivanov wrote:
> From: "Lubomir I. Ivanov" <neolit123 at gmail.com>
> 
> Fixes #739
> 
> Signed-off-by: Lubomir I. Ivanov <neolit123 at gmail.com>
> ---
>  qt-ui/models.cpp | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp
> index ef76e7e..f548d37 100644
> --- a/qt-ui/models.cpp
> +++ b/qt-ui/models.cpp
> @@ -1081,7 +1081,7 @@ static int nitrox_sort_value(struct dive *dive)
>  	return he * 1000 + o2;
>  }
>  
> -static QVariant dive_table_alignment(int column)
> +static QVariant dive_table_alignment(int column, bool isHeader)
>  {
>  	QVariant retVal;
>  	switch (column) {
> @@ -1093,7 +1093,7 @@ static QVariant dive_table_alignment(int column)
>  	case DiveTripModel::OTU:
>  	case DiveTripModel::MAXCNS:
>  		// Right align numeric columns
> -		retVal = int(Qt::AlignRight | Qt::AlignVCenter);
> +		retVal = int((isHeader ? Qt::AlignLeft : Qt::AlignRight) | Qt::AlignVCenter);
>  		break;
>  	// NR needs to be left aligned becase its the indent marker for trips too
>  	case DiveTripModel::NR:
> @@ -1116,7 +1116,7 @@ QVariant DiveItem::data(int column, int role) const
>  
>  	switch (role) {
>  	case Qt::TextAlignmentRole:
> -		retVal = dive_table_alignment(column);
> +		retVal = dive_table_alignment(column, false);
>  		break;
>  	case DiveTripModel::SORT_ROLE:
>  		Q_ASSERT(dive != NULL);
> @@ -1353,7 +1353,7 @@ QVariant DiveTripModel::headerData(int section, Qt::Orientation orientation, int
>  
>  	switch (role) {
>  	case Qt::TextAlignmentRole:
> -		ret = dive_table_alignment(section);
> +		ret = dive_table_alignment(section, true);
>  		break;
>  	case Qt::FontRole:
>  		ret = defaultModelFont();
> -- 
> 1.7.11.msysgit.0
> 
> _______________________________________________
> subsurface mailing list
> subsurface at subsurface-divelog.org
> http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


More information about the subsurface mailing list