Skip to content
Permalink
Browse files

Right align times and dates in attribute table

  • Loading branch information
nyalldawson committed Jan 28, 2016
1 parent bb96c35 commit 77ba570f08f3d31409e41561cbfcf3ccb198955e
Showing with 3 additions and 2 deletions.
  1. +3 −2 src/gui/attributetable/qgsattributetablemodel.cpp
@@ -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 );

0 comments on commit 77ba570

Please sign in to comment.
You can’t perform that action at this time.