Bug 256145

Summary: Korganizer text align bug ?
Product: [Applications] korganizer Reporter: Aaron Lewis <the.warl0ck.1989>
Component: generalAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Korganizer-SummaryTableWidget-Text-Align

Description Aaron Lewis 2010-11-05 14:25:42 UTC
Created attachment 53160 [details]
Korganizer-SummaryTableWidget-Text-Align

Version:           unspecified (using Devel) 
OS:                Linux

See uploaded picture.

Text Alignment for the Table Widget on the left

Reproducible: Always
Comment 1 Aaron Lewis 2010-11-05 14:26:12 UTC
KDELIBS 4.5.3
ORganizer 4.4.7
Comment 2 Sergio Martins 2010-12-31 02:41:38 UTC
commit e7a26ec0756ee5bdad9c040fc0aef9c6ee67e6f5
branch master
Author: Sergio Martins <iamsergio@gmail.com>
Date:   Fri Dec 31 01:39:56 2010 +0000

    Center these columns in to-do view: priority, recurs, percent and due date.
    They were already centered in the header.
    BUG: 256145

diff --git a/korganizer/views/todoview/kotodomodel.cpp b/korganizer/views/todoview/kotodomodel.cpp
index 4d7b83f..64dafcb 100644
--- a/korganizer/views/todoview/kotodomodel.cpp
+++ b/korganizer/views/todoview/kotodomodel.cpp
@@ -776,6 +776,18 @@ QVariant KOTodoModel::data( const QModelIndex &index, int role ) const
     }
   }
 
+  if ( role == Qt::TextAlignmentRole ) {
+    switch ( index.column() ) {
+      // If you change this, change headerData() too.
+      case RecurColumn:
+      case PriorityColumn:
+      case PercentColumn:
+      case DueDateColumn:
+        return QVariant( Qt::AlignHCenter );
+    }
+    return QVariant();
+  }
+
   return QVariant();
 }
 
@@ -812,9 +824,11 @@ QVariant KOTodoModel::headerData( int column,
 
   if ( role == Qt::TextAlignmentRole ) {
     switch ( column ) {
+      // If you change this, change data() too.
       case RecurColumn:
       case PriorityColumn:
       case PercentColumn:
+      case DueDateColumn:
         return QVariant( Qt::AlignHCenter );
     }
     return QVariant();