From bfb3d783672e41a5c49e31ade30a25c8ef91f533 Mon Sep 17 00:00:00 2001 From: Abs62 Date: Mon, 2 Sep 2013 19:47:09 +0400 Subject: [PATCH] Some more RTL support for wordlist and history list (issue #384) --- delegate.cc | 10 ++++++++++ wordlist.cc | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/delegate.cc b/delegate.cc index c69dcf7e..574697c3 100644 --- a/delegate.cc +++ b/delegate.cc @@ -14,6 +14,16 @@ void WordListItemDelegate::paint( QPainter *painter, const QStyleOptionViewItem 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 ); } diff --git a/wordlist.cc b/wordlist.cc index ecc01175..25a44224 100644 --- a/wordlist.cc +++ b/wordlist.cc @@ -114,6 +114,11 @@ void WordList::updateMatchResults( bool finished ) 20000 , QPixmap( ":/icons/error.png" ) ); } + if( !results.empty() && results.front().first.isRightToLeft() ) + setLayoutDirection( Qt::RightToLeft ); + else + setLayoutDirection( Qt::LeftToRight ); + emit contentChanged(); }