File size: 641 Bytes
b6bd94d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include "delegate.hh"

WordListItemDelegate::WordListItemDelegate( QAbstractItemDelegate * delegate ):
  QStyledItemDelegate()
{
  mainDelegate = static_cast< QStyledItemDelegate * >( delegate );
}

void WordListItemDelegate::paint( QPainter * painter,
                                  const QStyleOptionViewItem & option,
                                  const QModelIndex & index ) const
{
  QStyleOptionViewItem opt = option;
  initStyleOption( &opt, index );
  if ( opt.text.isRightToLeft() ) {
    opt.direction = Qt::RightToLeft;
  }
  else {
    opt.direction = Qt::LeftToRight;
  }
  mainDelegate->paint( painter, opt, index );
}