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. how to rotate font awesome icon in qt

how to rotate font awesome icon in qt

Scheduled Pinned Locked Moved Solved Mobile and Embedded
5 Posts 2 Posters 1.3k 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.
  • Q Offline
    Q Offline
    Qt embedded developer
    wrote on last edited by
    #1

    i am showing font awesome icon on label. i want to not rotate label. i want to rotate this icon how its possible?

    jsulmJ 1 Reply Last reply
    0
    • Q Offline
      Q Offline
      Qt embedded developer
      wrote on last edited by
      #5

      i have created child class for inherited base class label . then in child class i used paint event , in same event i used below QStylePainter to rotate my font awesome icon like below

      QStylePainter painter(this);
      QFont font1;
      font1.setFamily("FontAwesome");
      font1.setPixelSize(30);
      painter.setFont(font1);
      painter.rotate(90);
      painter.drawText(0, 0, ICON_BOLT);

      1 Reply Last reply
      0
      • Q Qt embedded developer

        i am showing font awesome icon on label. i want to not rotate label. i want to rotate this icon how its possible?

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #2

        @Qt-embedded-developer You can use one of the https://doc.qt.io/qt-5/qicon.html#pixmap methods to get QPixmap, then rotate it using https://doc.qt.io/qt-5/qpixmap.html#transformed and constrcu QIcon again from that rotated QPixmap.

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        Q 2 Replies Last reply
        0
        • jsulmJ jsulm

          @Qt-embedded-developer You can use one of the https://doc.qt.io/qt-5/qicon.html#pixmap methods to get QPixmap, then rotate it using https://doc.qt.io/qt-5/qpixmap.html#transformed and constrcu QIcon again from that rotated QPixmap.

          Q Offline
          Q Offline
          Qt embedded developer
          wrote on last edited by Qt embedded developer
          #3

          @jsulm I have tried many things .

          So I think qt does not support the rotate function for font awesome icon.

          Is it true or not ?

          If its true then please provide provide example for rotate font awesome icon ICON_BOLT [ \uF0E7]

          ui->label_2->setText(ICON_BOLT);

          1 Reply Last reply
          0
          • jsulmJ jsulm

            @Qt-embedded-developer You can use one of the https://doc.qt.io/qt-5/qicon.html#pixmap methods to get QPixmap, then rotate it using https://doc.qt.io/qt-5/qpixmap.html#transformed and constrcu QIcon again from that rotated QPixmap.

            Q Offline
            Q Offline
            Qt embedded developer
            wrote on last edited by
            #4

            @jsulm i think your suggested property only can rotate image but can not rotate font awesome icon

            1 Reply Last reply
            0
            • Q Offline
              Q Offline
              Qt embedded developer
              wrote on last edited by
              #5

              i have created child class for inherited base class label . then in child class i used paint event , in same event i used below QStylePainter to rotate my font awesome icon like below

              QStylePainter painter(this);
              QFont font1;
              font1.setFamily("FontAwesome");
              font1.setPixelSize(30);
              painter.setFont(font1);
              painter.rotate(90);
              painter.drawText(0, 0, ICON_BOLT);

              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