From 704a53bb1284a7daa10f0da0793c12031918b014 Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Fri, 14 Dec 2007 22:08:22 +0000 Subject: [PATCH] get correctly the layout direction of the widget, thanks Diego svn path=/trunk/KDE/kdegraphics/okular/; revision=748587 --- ui/pageviewutils.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ui/pageviewutils.cpp b/ui/pageviewutils.cpp index a40da2ed4..7364ea59a 100644 --- a/ui/pageviewutils.cpp +++ b/ui/pageviewutils.cpp @@ -144,7 +144,7 @@ PageViewMessage::PageViewMessage( QWidget * parent ) pal.setColor( QPalette::Active, QPalette::Window, QApplication::palette().color( QPalette::Active, QPalette::Window ) ); setPalette( pal ); // if the layout is LtR, we can safely place it in the right position - if ( QApplication::isLeftToRight() ) + if ( layoutDirection() == Qt::LeftToRight ) move( 10, 10 ); resize( 0, 0 ); hide(); @@ -160,6 +160,8 @@ void PageViewMessage::display( const QString & message, Icon icon, int durationM return; } + bool isRTL = layoutDirection() == Qt::RightToLeft; + // determine text rectangle QRect textRect = fontMetrics().boundingRect( message ); textRect.translate( -textRect.left(), -textRect.top() ); @@ -192,7 +194,7 @@ void PageViewMessage::display( const QString & message, Icon icon, int durationM symbol = SmallIcon( "dialog-information" ); break; } - if ( QApplication::isRightToLeft() ) + if ( isRTL ) { iconXOffset = 2 + textRect.width(); } @@ -238,7 +240,7 @@ void PageViewMessage::display( const QString & message, Icon icon, int durationM // if the layout is RtL, we can move it to the right place only after we // know how much size it will take - if ( QApplication::isRightToLeft() ) + if ( isRTL ) move( parentWidget()->width() - geometry.width() - 10 - 1, 10 ); // show widget and schedule a repaint