Hello!

I want QLabel, that contains image, make image bigger on enterEvent,
and smaller on leaveEvent. (animate it by QPropertyAnimation and QStateMachine ). For this purposes I subclassed QLabel, just like this:

Qt Code:
  1. class MyLabel : public QLabel
  2. {
  3. Q_OBJECT
  4.  
  5. public:
  6. MyLabel(QWidget * parent = 0);
  7. ~MyLabel();
  8.  
  9. protected slots:
  10.  
  11. virtual void enterEvent ( QEvent * event );
  12. virtual void leaveEvent ( QEvent * event );
  13. };
  14.  
  15. MyLabel::MyLabel(QWidget * parent) : QWidget(parent)
  16. {
  17. }
  18.  
  19. MyLabel::~MyLabel()
  20. {
  21. }
  22.  
  23. void MyLabel::enterEvent ( QEvent * event )
  24. {
  25. }
  26.  
  27. void MyLabel::leaveEvent ( QEvent * event )
  28. {
  29. }
To copy to clipboard, switch view to plain text mode 

But what next - have no idea...

Tried something like :

Qt Code:
  1. void MyLabel::enterEvent ( QEvent * event )
  2. {
  3.  
  4. QPropertyAnimation *animation = new QPropertyAnimation(this, "geometry");
  5. animation->setDuration(600);
  6. animation->setStartValue(QRect(this->geometry().x(), this->geometry().y(), 64, 64));
  7. animation->setEndValue(QRect(this->geometry().x(), this->geometry().y(), 128, 128));
  8. animation->start();
  9. }
To copy to clipboard, switch view to plain text mode 

But that is not the idea, because this->geometry().x() returns 0....