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. Font size paint by QPainter do not looks consistent under different resolution

Font size paint by QPainter do not looks consistent under different resolution

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 645 Views
  • 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.
  • thamT Offline
    thamT Offline
    tham
    wrote on last edited by
    #1

    As the title mentioned, I draw the text on different images with different resolutions with

    QPainter painter(&result);
    QFont font("Verdana");
    font.setWeight(QFont::ExtraBold);
    font.setPixelSize(20);
    painter.setFont(font);
    painter.drawText(static_cast<int>(i.x), static_cast<int>(i.y - 16), obj_name.c_str());
    

    How could I make the size of the text looks consistent under different resolution?Thanks

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

      Hi,

      Do you mean the text should grow depending on the size of the widget ?

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

      thamT 1 Reply Last reply
      1
      • SGaistS SGaist

        Hi,

        Do you mean the text should grow depending on the size of the widget ?

        thamT Offline
        thamT Offline
        tham
        wrote on last edited by
        #3

        @SGaist Nope, I mean the text draw on the image. I find out the reason already, I forgot I resize the image if their width or height bigger than certain value, that is what makes the size of the same pixels become different, yet another stupid bug :)

        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