。。。没人回答,自己解决了。把解决方法贴上来,以免后人遇到相同的问题,可以提供一种解决方案。
相关的几个函数:
void QGraphicsItem::hoverEnterEvent( QGraphicsSceneHoverEvent *event);
void QGraphicsItem::hoverLeaveEnvet( QGraphicsSceneHoverEnet *event);
还有两个类
QTimeLine 和 QGraphicsItemAnimation;
利用QTimeLine 和 QGraphicsItemAnimation创造动画,然后在
void QGraphicsItem::hoverEnterEvent( QGraphicsSceneHoverEvent *event);
void QGraphicsItem::hoverLeaveEnvet( QGraphicsSceneHoverEnet *event);
这两个函数里面进行响应就好了;
还有记得在构造函数里面打开hover响应,如下:
setAcceptsHoverEvents(true);