mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-12-05 00:24:06 +00:00
b5349478cf
The next commit will add `.git-blame-ignore-revs` https://docs.github.com/en/repositories/working-with-files/using-files/viewing-a-file#ignore-commits-in-the-blame-view
31 lines
892 B
C++
31 lines
892 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 opt4 = option;
|
|
|
|
QStyleOptionViewItem opt = option;
|
|
initStyleOption( &opt4, index );
|
|
if ( opt4.text.isRightToLeft() ) {
|
|
opt.direction = Qt::RightToLeft;
|
|
if ( opt4.textElideMode != Qt::ElideNone )
|
|
opt.textElideMode = Qt::ElideLeft;
|
|
}
|
|
else {
|
|
opt.direction = Qt::LeftToRight;
|
|
if ( opt4.textElideMode != Qt::ElideNone )
|
|
opt.textElideMode = Qt::ElideRight;
|
|
}
|
|
mainDelegate->paint( painter, opt, index );
|
|
}
|