Some more RTL support for wordlist and history list (issue #384)

This commit is contained in:
Abs62 2013-09-02 19:47:09 +04:00
parent c7cc9e41df
commit bfb3d78367
2 changed files with 15 additions and 0 deletions

View file

@ -14,6 +14,16 @@ void WordListItemDelegate::paint( QPainter *painter, const QStyleOptionViewItem
QStyleOptionViewItem opt = option; QStyleOptionViewItem opt = option;
initStyleOption( &opt4, index ); initStyleOption( &opt4, index );
if( opt4.text.isRightToLeft() ) if( opt4.text.isRightToLeft() )
{
opt.direction = Qt::RightToLeft; 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 ); mainDelegate->paint( painter, opt, index );
} }

View file

@ -114,6 +114,11 @@ void WordList::updateMatchResults( bool finished )
20000 , QPixmap( ":/icons/error.png" ) ); 20000 , QPixmap( ":/icons/error.png" ) );
} }
if( !results.empty() && results.front().first.isRightToLeft() )
setLayoutDirection( Qt::RightToLeft );
else
setLayoutDirection( Qt::LeftToRight );
emit contentChanged(); emit contentChanged();
} }