Unsolved QPainter & QPrinter
-
Hi
I have problem with qpainter direction
I want to draw a text from right to left by drawText func but i dont know how to set direction -
@KoLiBer Check layoutDirection.
-
thanks
I thought for printing rtl text from right of the page to left setting page dir is enough but It was a mistakeQFont font("Arial",10);
QFontMetrics mtc(font);
QString text = ".....";
painter.drawText( painter.device()->width() - mtc.width(text) , 0 , text);By this code i draw the text from the right of the page to left
but apparently it has a problem
it draws the text with gap from the right of the page and that gap is not fixed -
@KoLiBer Here
painter.drawText( painter.device()->width() - mtc.width(text) , 0 , text);
you set x= painter.device()->width() - mtc.width(text)
Why don't you just set it to painter.device()->width()? Why do you subtract mtc.width(text)? -
because my text direction is rtl ( persian ) and if i set x to
painter.device()->width() entire of the text will be placed at the page outnow i'm trying to print the page by rich text ( QTextDocument )
at the other hand i face with the problem of width at div tag