Hi,

I've tried to apply QGraphicsBlurEffect to my QGraphicsPixmapItem, but after doing so, my item disappears form the scene!

Thats the code i've used:

Qt Code:
  1. Player* player(playerImage);
  2. scene.addItem(player);
  3.  
  4. QGraphicsBlurEffect* blur = new QGraphicsBlurEffect;
  5. player->setGraphicsEffect(blur);
To copy to clipboard, switch view to plain text mode 

here's Player class:

player.h
Qt Code:
  1. #ifndef PADDLE_H
  2. #define PADDLE_H
  3.  
  4. #include <QGraphicsItem>
  5.  
  6. class Player : public QGraphicsPixmapItem
  7. {
  8. public:
  9. Player(QPixmap* _image);
  10.  
  11. QRectF boundingRect() const;
  12. QPainterPath shape() const;
  13. void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
  14.  
  15. QPixmap image;
  16. };
  17.  
  18. #endif // PADDLE_H
To copy to clipboard, switch view to plain text mode 

player.cpp
Qt Code:
  1. #include <QPainter>
  2.  
  3. #include "player.h"
  4.  
  5.  
  6. Player::Player(QPixmap* _image)
  7. {
  8. image = _image->scaled(QSize(100,100),Qt::KeepAspectRatio);
  9. }
  10.  
  11. QRectF Player::boundingRect() const
  12. {
  13. return image.rect();
  14. }
  15.  
  16. QPainterPath Player::shape() const
  17. {
  18. QPainterPath path;
  19. path.addRect(image.rect());
  20. return path;
  21. }
  22.  
  23. void Player::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
  24. {
  25. painter->drawPixmap(-image.rect().width(),-image.rect().height(),image);
  26. }
To copy to clipboard, switch view to plain text mode 

What should I do?