Hello.
As I suprisingly noticed, calling scale() method on QGraphicsSvgItem doesn't change its bounding rect. To fix it, I made my own class inheriting from it which updates the bounding rect when needed. The problem is the Qt finds it somehow invalid, for example when i call the moveBy() method on the item, only the part of the item is moved. Furthermore, mouseReleaseEvent() catches only clicks in that area. what could be the reason of this behaviour?

Screenshot

I'm quite sure the bounding rect returned is correct, I even checked with screen ruler and it turned out to be right.

Here is some code (I left only important parts):
Qt Code:
  1. class Card : public QGraphicsSvgItem {
  2. Q_OBJECT
  3.  
  4. public:
  5. Card(CardType type, CardValue value, QSvgRenderer * renderer);
  6. void scale(qreal sx, qreal sy);
  7. QRectF boundingRect() const;
  8.  
  9. signals:
  10. void clicked(Card * card);
  11.  
  12. private:
  13. QRectF * rect;
  14.  
  15. void mouseReleaseEvent(QGraphicsSceneMouseEvent * event);
  16.  
  17. };
To copy to clipboard, switch view to plain text mode 
Qt Code:
  1. Card::Card(CardType type, CardValue value, QSvgRenderer * renderer){
  2. prepareGeometryChange();
  3. this->rect = new QRectF(QGraphicsSvgItem::boundingRect());
  4. scale(this->scaleRatio, this->scaleRatio);
  5. }
  6.  
  7. void Card::scale(qreal sx, qreal sy){
  8. this->rect->setWidth(this->rect->width()*sx);
  9. this->rect->setHeight(this->rect->height()*sy);
  10. QGraphicsSvgItem::scale(sx, sy);
  11. }
  12.  
  13. QRectF Card::boundingRect() const {
  14. return *(this->rect);
  15. }
  16.  
  17. void Card::mouseReleaseEvent(QGraphicsSceneMouseEvent * event){
  18. emit clicked(this);
  19. }
To copy to clipboard, switch view to plain text mode 
and the slot connected to clicked():
Qt Code:
  1. void BoardWidget::cardClicked(Card * card) {
  2. qDebug() << "Kliknieto" << *card << card->boundingRect();
  3. card->moveBy(10, 10);
  4. }
To copy to clipboard, switch view to plain text mode 
The bounding rect of the card in cardClicked() matches with the real size, its shape too. What could be the reason of the problem?