mirror of
https://invent.kde.org/graphics/okular
synced 2024-09-12 20:51:17 +00:00
In the message widget, draw the icon on the right when the layout is RightToLeft.
svn path=/trunk/KDE/kdegraphics/okular/; revision=748578
This commit is contained in:
parent
f4c249060d
commit
1bf39cf98a
|
@ -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;
|
||||
}
|
||||
if ( QApplication::isRightToLeft() )
|
||||
{
|
||||
iconXOffset = 2 + textRect.width();
|
||||
}
|
||||
else
|
||||
{
|
||||
textXOffset = 2 + symbol.width();
|
||||
width += textXOffset;
|
||||
}
|
||||
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;
|
||||
|
|
Loading…
Reference in a new issue