|
Syylc120317 发表于 2014-4-2 21:45
嗯,在父对象的构造函数里加上installEventFilter(item);
我在所有Item的基类中实现了sceneEventFilter,在往Group中添加Item 的同时 installSceneEventFilter(item);
到时进入到顶层基类中了,但是异常结束了。下面是sceneEventFilter实现代码:
bool QGCompFounder::sceneEventFilter(QGraphicsItem *watched, QEvent *event)
{
qDebug()<<"QGCompFounder::sceneEventFilter item=="<<watched
<<" event=="<<event->type()<<"toGraphicsObject is:"<<watched->toGraphicsObject();
return QGraphicsItem::sceneEventFilter(watched,event);
}
调试提示如“调试信息截图”。
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
|