From 1bf39cf98a269769844baa6cf4ef63c2c7ae7dca Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Fri, 14 Dec 2007 21:37:00 +0000 Subject: [PATCH] In the message widget, draw the icon on the right when the layout is RightToLeft. svn path=/trunk/KDE/kdegraphics/okular/; revision=748578 --- ui/pageviewutils.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/ui/pageviewutils.cpp b/ui/pageviewutils.cpp index 29c520bdd..a40da2ed4 100644 --- a/ui/pageviewutils.cpp +++ b/ui/pageviewutils.cpp @@ -167,6 +167,7 @@ void PageViewMessage::display( const QString & message, Icon icon, int durationM int width = textRect.width(), height = textRect.height(), textXOffset = 0, + iconXOffset = 0, shadowOffset = message.isRightToLeft() ? -1 : 1; // load icon (if set) and update geometry @@ -191,8 +192,15 @@ void PageViewMessage::display( const QString & message, Icon icon, int durationM symbol = SmallIcon( "dialog-information" ); break; } - textXOffset = 2 + symbol.width(); - width += textXOffset; + if ( QApplication::isRightToLeft() ) + { + iconXOffset = 2 + textRect.width(); + } + else + { + textXOffset = 2 + symbol.width(); + } + width += 2 + symbol.width(); height = qMax( height, symbol.height() ); } QRect geometry( 0, 0, width + 10, height + 8 ); @@ -219,7 +227,7 @@ void PageViewMessage::display( const QString & message, Icon icon, int durationM // draw icon if present if ( !symbol.isNull() ) - bufferPainter.drawPixmap( 5, 4, symbol, 0, 0, symbol.width(), symbol.height() ); + bufferPainter.drawPixmap( 5 + iconXOffset, 4, symbol, 0, 0, symbol.width(), symbol.height() ); // draw shadow and text int yText = geometry.height() - height / 2;