Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Rendering issue of QPainter drawText method



  • I'm using QPainter and drawText method to draw text. Sometimes appears weird text rendering issue. I cannot find out any dependencies. It's interesting that only some letters are deformed. Have anyone ever noticed such problems before?

    Look at inscription at the bottom of the picture.

    !https://drive.google.com/file/d/0Bz-6ze41OtiVR3o1UkhRZ3U0em8/view?usp=sharing()!


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Are you using the same font for all drawing ? Is it the same string that use to draw both texts (the one that seem to be similar) ?



  • Are you drawing this text in QWidget or QGraphicsItem? I suppose that you are reimplementing some protected function. Which one?

    QWidget documentation: painting using a QPainter can only take place in a paintEvent() or a function called by a paintEvent()

    You should consider whether to use dedicated classes for drawing text like QLabel or QGraphicsSimpleTextItem.


Log in to reply