title: How to rotate an image around its centre in QT QWidgets C++?
body: <p>I am trying to rotate am image around its origin(center) in QT using QWidgts in C++. I experimented a lot of things here, but no matter what I do, the image keeps rotating around some arbitrary position I have no clue of. Kindly, help me out here. I am new to QT.</p>
  
  <pre><code>void gaugeWithRedZoneImage::rotate()
  {
      QPixmap pixmap(*gaugeMainScreen-&gt;pixmap());
      QMatrix rm;
      rm.translate(0, 0);
      rm.rotate(-360);
      pixmap = pixmap.transformed(rm);
      gaugeMainScreen-&gt;setPixmap(pixmap);
  
      /*QTransform rotate_disc;
      rotate_disc.translate(pixmap.width()/2.0 , pixmap.height()/2.0);
      rotate_disc.rotate(-60);
      rotate_disc.translate(-(pixmap.width()/2.0) , -(pixmap.height()/2.0));
      pixmap = pixmap.transformed(rotate_disc);
      gaugeMainScreen-&gt;setPixmap(pixmap);*/
  }
  </code></pre>