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. How to rotate a Pixmap around bottom, right corner?
Forum Updated to NodeBB v4.3 + New Features

How to rotate a Pixmap around bottom, right corner?

Scheduled Pinned Locked Moved Solved General and Desktop
pixmap rotatirotationqtransformqgraphicspixmaqgraphics
2 Posts 2 Posters 678 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.
  • M Offline
    M Offline
    michelmadeira
    wrote on last edited by michelmadeira
    #1

    Hi guys,

    This code is not working. The origin is not changing trought the member called by inheritance.
    The rotation matrix is ok.

    The image is 88x63 pixels.

    What i´m missing?

    How to change anchor point of a pixmap rotation?

        QPixmap rpm(":/assets/assets/RPM_POINTER.png");
        QGraphicsPixmapItem rpmgauge(rpm);
        rpmgauge.setTransformOriginPoint(88,-63);
        
        QTransform rm;
        rm.rotate(45);
        
        rpm = rpmgauge.pixmap();
        graphic->addPixmap(rpm.transformed(rm));
        ui->graphicView->setScene(graphic);
    
    

    Thank you

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @michelmadeira said in How to rotate a Pixmap around bottom, right corner?:

      How to change anchor point of a pixmap rotation?

      By modifying your QTransform to set 0/0 to the bottom right corner because the Qt coordinate system starts with 0/0 in the upper left.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      2

      • Login

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