Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Issue with QLabel rotation on Qt4.8 & WinCE6.0
Forum Updated to NodeBB v4.3 + New Features

Issue with QLabel rotation on Qt4.8 & WinCE6.0

Scheduled Pinned Locked Moved Mobile and Embedded
6 Posts 2 Posters 1.9k 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.
  • W Offline
    W Offline
    wndx
    wrote on last edited by
    #1

    I seem to be stuck with an issue where i'm unable to rotate text appropriately on WinCE6.0 device using Qt4.8. Device is supposed to be in portrait mode (default landscape) for this instance of application. This requires rotating most of the widgets by 90 degrees.

    In order to do this with QLabel, i'm re-implementing it's QPaint even with "some" success.

    What i'm getting when i'm using

    QPainter.rotate(90.0)
    

    is:

    T
    E
    S
    T

    What i want to get instead is individual character rotate by 90.0 degrees as opposed to the whole text. So it would look like this instead:

    0_1473242564369_upload-3e6c1034-e5db-4004-ac08-3129c883f9c8

    Any advice on this would be much appreciated. Thanks!

    1 Reply Last reply
    0
    • W Offline
      W Offline
      wndx
      wrote on last edited by
      #2

      Anybody?

      1 Reply Last reply
      0
      • mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by mrjj
        #3

        Hi
        Image upload is sadly broken at the moment so your
        image is not visible to others. (must upload to other place)

        So its unclear for me what the wanted text should look like. :)

        My guess is :

        void VertLabel::paintEvent(QPaintEvent *)
        {
        QPainter painter(this);
        painter.setPen(Qt::black);
        painter.rotate(90);
        painter.drawText(QPoint(0,-15), "abcdefgh" );
        }

        if this draw differently on WinCE6.0, it might not be supported or bugged.
        This is on win 10, Qt 5.7.

        1 Reply Last reply
        0
        • W Offline
          W Offline
          wndx
          wrote on last edited by
          #4

          Hi mrjj,

          Thanks for your reply. You're right, what you have in your attached image is what i'm expecting my text to be, but unfortunately it's draws as in my first example. I've tried your suggested code with the same results, so it looks like a bug...

          Do you've any other ideas how i might achieve similar result, any of the following worth a try?

          • Try it with a different widget type, not a QLabel?
          • Try rotating QPixmap of QLabel after drawing (already tired this with no success, but still not entirely sure it was 100% correct). In essence, would text drawn using "drawText" routine would be treated as QPixmap after it has been draw on the QLabel face or would it remain text all the time?

          Appreciate your reply!

          1 Reply Last reply
          0
          • mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #5

            hi
            Drawing non rotated text should work.
            But let us just test it :)

            (note. fast code. not pretty)

            void VertLabel::paintEvent(QPaintEvent*) {
            QPainter painter(this);
            QPixmap pix(width(), height());
            QPainter pp(&pix);
            pix.fill();
            pp.setPen(Qt::black);
            pp.drawText(QPoint(0, 25), "abcdefgh" );
            painter.rotate(90);
            painter.drawPixmap(0, -50, pix);

            }

            W 1 Reply Last reply
            2
            • mrjjM mrjj

              hi
              Drawing non rotated text should work.
              But let us just test it :)

              (note. fast code. not pretty)

              void VertLabel::paintEvent(QPaintEvent*) {
              QPainter painter(this);
              QPixmap pix(width(), height());
              QPainter pp(&pix);
              pix.fill();
              pp.setPen(Qt::black);
              pp.drawText(QPoint(0, 25), "abcdefgh" );
              painter.rotate(90);
              painter.drawPixmap(0, -50, pix);

              }

              W Offline
              W Offline
              wndx
              wrote on last edited by
              #6

              @mrjj

              Hi mrjj,

              Sorry for delayed response, was away from work for few weeks.
              Just tried your solution and it's working like a charm!

              Thanks for your help on this, much appreciated!

              1 Reply Last reply
              1

              • Login

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