Skip to content

Commit 77ba570

Browse files
committed
Right align times and dates in attribute table
1 parent bb96c35 commit 77ba570

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/gui/attributetable/qgsattributetablemodel.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -561,11 +561,12 @@ QVariant QgsAttributeTableModel::data( const QModelIndex &index, int role ) cons
561561
QgsField field = layer()->fields().at( fieldId );
562562

563563
QVariant::Type fldType = field.type();
564-
bool fldNumeric = ( fldType == QVariant::Int || fldType == QVariant::Double || fldType == QVariant::LongLong );
564+
bool fldRightAlign = ( fldType == QVariant::Int || fldType == QVariant::Double || fldType == QVariant::LongLong
565+
|| fldType == QVariant::DateTime || fldType == QVariant::Date || fldType == QVariant::Time );
565566

566567
if ( role == Qt::TextAlignmentRole )
567568
{
568-
if ( fldNumeric )
569+
if ( fldRightAlign )
569570
return QVariant( Qt::AlignRight );
570571
else
571572
return QVariant( Qt::AlignLeft );

0 commit comments

Comments
 (0)