mirror of
https://invent.kde.org/graphics/okular
synced 2024-09-12 20:51:17 +00:00
get correctly the layout direction of the widget, thanks Diego
svn path=/trunk/KDE/kdegraphics/okular/; revision=748587
This commit is contained in:
parent
1bf39cf98a
commit
704a53bb12
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue