Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QPainter drawText vs QML Text

QPainter drawText vs QML Text

Scheduled Pinned Locked Moved Unsolved General and Desktop
qpaintertextqmlcpp
6 Posts 2 Posters 2.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Z Offline
    Z Offline
    Zondar
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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).

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • Z Offline
        Z Offline
        Zondar
        wrote on last edited by
        #3

        Hi,

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

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          What problem are you having ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • Z Offline
            Z Offline
            Zondar
            wrote on last edited by Zondar
            #5

            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

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Aliasing problem ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved