RTL desktop and BiDi issues in KDE4

Robert Knight robertknight at gmail.com
Fri Jan 25 18:41:05 GMT 2008


> Setting the direction of
> TerminalDisplay did not help, and setting the layoutDirection on the QPainter
> on the paintEvent() did not help.

Fixed.  The reason why setting the layoutDirection property on the
widget and painter had no effect is due to a quirk in

drawText() has many overloads, one of which is
drawText(area,text,textOption = QTextOption()), which I picked since I
had a rectangle and some text to draw in it and didn't care about
anything else.  The third parameter is given a default value of
QTextOption(), which specifies its own layout direction.  QPainter
then uses the textOption argument to decide how to draw the text and
ignores its layoutDirection setting.  The QTextOption constructor sets
the layout direction to the application's text layout direction rather
than the widget's layout direction.

The solution is to replace the drawText() call with a different one
which doesn't have a QTextOption argument and therefore uses the
painter's layoutDirection, which is inherited from the widget's


On 25/01/2008, John Tapsell <johnflux at gmail.com> wrote:
> Hi Diego,
> > I am posing this in this list, since I assume (almost) every application in
> > KDE has some issue related to RTL/BiDi, and sometimes, it's plainly easy to
> > test this: just run your application with the switch "--reverse".
> Could you test out ksysguard? It has quite a few custom widgets.  I
> asked around for someone to test it for me, but at the time couldn't
> find any RTL speakers.  It all looks very strange when shown RTL, so
> it can be hard to tell if it's wrong or not.
> Thanks

More information about the kde-core-devel mailing list