mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-12-18 15:34:06 +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 );
|
|
}
|