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. words alignment in text is not good while drawing text by rotating the painter
Forum Updated to NodeBB v4.3 + New Features

words alignment in text is not good while drawing text by rotating the painter

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 520 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.
  • B Offline
    B Offline
    Bikram Shishodia
    wrote on last edited by
    #1

    Hi,
    I am drawing text by rotating the painter to 45 degree or any. Then the text alignment is not good.
    I am using following code:
    painter.rotate(45);
    painter.drawText(QRectF(x,y,DEFAULT_TRACK_LEN, HEIGHT),ZERO,m_TrackNotes.toUpper());
    painter.resetTransform();
    For output,See the image below.
    0_1557906978904_41259b73-33c9-455a-a1f1-e28c02c4d1b9-image.png

    However drawing text horizontally is good, See the Image:
    0_1557907226134_fae31568-dea1-49dc-b9d2-f105d7f91e18-image.png

    Anyone help please.

    1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2

      I'm not sure I see what the problem is. I can however propose the alternative of printing with the non-rotated painter on a transparent QPixmap instead of directly on screen and then use drawPixmap with a rotated painter to put it on screen.

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      sierdzioS B 2 Replies Last reply
      4
      • VRoninV VRonin

        I'm not sure I see what the problem is. I can however propose the alternative of printing with the non-rotated painter on a transparent QPixmap instead of directly on screen and then use drawPixmap with a rotated painter to put it on screen.

        sierdzioS Offline
        sierdzioS Offline
        sierdzio
        Moderators
        wrote on last edited by
        #3

        @VRonin said in words alignment in text is not good while drawing text by rotating the painter:

        I'm not sure I see what the problem is

        I think it's about the "s" characters, they fall quite visibly below the line of text.

        (Z(:^

        1 Reply Last reply
        0
        • VRoninV VRonin

          I'm not sure I see what the problem is. I can however propose the alternative of printing with the non-rotated painter on a transparent QPixmap instead of directly on screen and then use drawPixmap with a rotated painter to put it on screen.

          B Offline
          B Offline
          Bikram Shishodia
          wrote on last edited by
          #4

          @VRonin
          Compare the letters alignment of the text in rotated painter and non-rotated painter. You will see some letters are down and some letters are up in the rotated painter text.
          However, I will try the alternative suggested.
          Thanks

          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