I thought i knew how to do it when i was traveling with a train but now that i tried doing it it doesn't work... Can someone please tell me how to do it properly, or what am i missing here... I tried doing something and the picture stay the same :

Qt Code:
  1. Player::Player(QGraphicsPixmapItem *parent)
  2. {
  3. QPixmap *t = new QPixmap(":/Images/PlayerMoveDownStill.png");
  4. setPixmap(*t);
  5. //setOpacity(0.5);
  6. setPos(game->width()/2-this->boundingRect().width()/2,game->height()/2-this->boundingRect().height()/2);
  7.  
  8. QImage tmp = t->toImage();
  9. QColor color;
  10.  
  11. for(int i=0;i<tmp.height();i++){
  12. for(int k=0;k<tmp.width();k++){
  13. //color.setRgb(255*0.5,255*0.5,255*0.5);
  14. color.setRgb(tmp.pixel(k,i));
  15. //color.setAlpha(tmp.pixelColor(k,i).alpha());
  16. color.setRgb(color.red()*0.5,color.blue()*0.5,color.green()*0.5);
  17. tmp.setPixelColor(k,i,color);
  18. }
  19. }
  20.  
  21. t->fromImage(tmp);
  22. }
To copy to clipboard, switch view to plain text mode