Navigation Menu

Skip to content

Commit

Permalink
Right align times and dates in attribute table
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jan 28, 2016
1 parent bb96c35 commit 77ba570
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/gui/attributetable/qgsattributetablemodel.cpp
Expand Up @@ -561,11 +561,12 @@ QVariant QgsAttributeTableModel::data( const QModelIndex &index, int role ) cons
QgsField field = layer()->fields().at( fieldId );

QVariant::Type fldType = field.type();
bool fldNumeric = ( fldType == QVariant::Int || fldType == QVariant::Double || fldType == QVariant::LongLong );
bool fldRightAlign = ( fldType == QVariant::Int || fldType == QVariant::Double || fldType == QVariant::LongLong
|| fldType == QVariant::DateTime || fldType == QVariant::Date || fldType == QVariant::Time );

if ( role == Qt::TextAlignmentRole )
{
if ( fldNumeric )
if ( fldRightAlign )
return QVariant( Qt::AlignRight );
else
return QVariant( Qt::AlignLeft );
Expand Down

0 comments on commit 77ba570

Please sign in to comment.