opt: remove explict RTL elide mode settings of text layout

This commit is contained in:
Xiao Yi Fang 2024-07-03 18:04:53 +08:00 committed by xiaoyifang
parent 932b88f743
commit 2053511856

View file

@ -12,19 +12,13 @@ void WordListItemDelegate::paint( QPainter * painter,
const QStyleOptionViewItem & option, const QStyleOptionViewItem & option,
const QModelIndex & index ) const const QModelIndex & index ) const
{ {
QStyleOptionViewItem opt4 = option;
QStyleOptionViewItem opt = option; QStyleOptionViewItem opt = option;
initStyleOption( &opt4, index ); initStyleOption( &opt, index );
if ( opt4.text.isRightToLeft() ) { if ( opt.text.isRightToLeft() ) {
opt.direction = Qt::RightToLeft; opt.direction = Qt::RightToLeft;
if ( opt4.textElideMode != Qt::ElideNone )
opt.textElideMode = Qt::ElideLeft;
} }
else { else {
opt.direction = Qt::LeftToRight; opt.direction = Qt::LeftToRight;
if ( opt4.textElideMode != Qt::ElideNone )
opt.textElideMode = Qt::ElideRight;
} }
mainDelegate->paint( painter, opt, index ); mainDelegate->paint( painter, opt, index );
} }