drawText with QPainter



  • Hello!

    I am using a QPainter to draw text and images in a QPrintPreviewDialog. I have a problem with the text, because when it is very long, it leaves the paper. Someone knows how to set the line breaks automatically?

    Thank you very much!



  • QTextOption options;
    options.setWrapMode(QTextOption::WordWrap);
    painter->drawText(rect,text,options);
    


  • @VRonin Thank you very much! Now, I have to set a bigger line spacing because they are very close.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.