Hello fellow programmers.

I have a question regarding my paintEvent in my class which is derived from QWidget. And what I am asking here is why does this paintEvent take up 70-80 % of my cpu when I add this object to a QGraphicsScene and move it around.

I know I can get a significant boost in performance by setting the QGraphcsItem:eviceCoordinateCache flag as cacheMode but I am just curios why my paintEvent is so heavy on the CPU and if I can somehow improve it.

PS. The pixmap that I am using is only loading the first time I create the object since I store it in the QPixmapCache and use it from there.

Qt Code:
  1. void CDITachometer::paintEvent(QPaintEvent *)
  2. {
  3.  
  4. /* Min rotate(-93)
  5.   * Max rotate(162)
  6.   * Mid rotate(36)
  7.   */
  8. QPainter boolPainter(this);
  9. boolPainter.setRenderHint(QPainter::SmoothPixmapTransform);
  10.  
  11. QPixmap pixmap = *QPixmapCache::find(accessibleName());
  12.  
  13. boolPainter.drawPixmap(0, 0, pixmap.scaled(size().width(), size().height(),
  14. Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
  15.  
  16. QTransform transform2;
  17. transform2.translate(size().width()/2, size().height()/2);
  18. transform2.rotate(m_rotation);
  19. transform2.translate(-size().width()/2, -size().height()/2);
  20.  
  21. boolPainter.setTransform(transform2);
  22.  
  23. pixmap = *QPixmapCache::find(accessibleName().append("1"));
  24.  
  25. boolPainter.drawPixmap(0, 0, pixmap.scaled(size().width(), size().height(),
  26. Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
  27. }
To copy to clipboard, switch view to plain text mode 

Thanks in advance and I appritiate all advice and comments