mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-23 20:14:05 +00:00
25 lines
674 B
C++
25 lines
674 B
C++
#include <QStyleOptionViewItem>
|
|
|
|
#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 );
|
|
}
|