QPainter drawText vs QML Text



  • Hi,

    I am writing components for QML in Cpp. I wanted to make button component and I noticed when I use custom font, then drawed text quality is really bad although QPainter::TextAntialiasing render hint was set. But when display text with Text element its quality is way more better. Any Ideas how to improve render quality of QPainter?

    Thanks in advance


  • Lifetime Qt Champion

    Hi,

    Not a direct answer but why not use QtQuick.Controls ? There's even a tech preview of the version 2 of these controls which should be even lighter (as in resources needed).



  • Hi,

    I thought about that, but when it comes to more complex components for example Graph, QML code becomes really confusing for me.


  • Lifetime Qt Champion

    What problem are you having ?



  • I created class in Cpp, which inherits from QQuickPaintedItem and used QPainter::drawText to draw text, its quality was quite nice, but when I added Q_PROPERTY(QFont ....) and then set painter font with QPainter::setFont, quality of drawn text decreased a lot. Then I tried to draw text with Text element with same custom font and result was way more better.
    EDIT: font property was set from QML using FontLoader
    EDIT: I think it might be because of bat settings, beacause when I draw some bigger text it seems fuzzy like when displaying resized small image to bigger canvas


  • Lifetime Qt Champion

    Aliasing problem ?


Log in to reply
 

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