2022-02-27 05:17:37 +00:00
|
|
|
#include <QStyleOptionViewItem>
|
2013-07-06 15:31:31 +00:00
|
|
|
|
|
|
|
#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;
|
2024-07-03 10:04:53 +00:00
|
|
|
initStyleOption( &opt, index );
|
|
|
|
if ( opt.text.isRightToLeft() ) {
|
2013-07-06 15:31:31 +00:00
|
|
|
opt.direction = Qt::RightToLeft;
|
2013-09-02 15:47:09 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
opt.direction = Qt::LeftToRight;
|
|
|
|
}
|
2013-07-06 15:31:31 +00:00
|
|
|
mainDelegate->paint( painter, opt, index );
|
|
|
|
}
|