• 4552阅读
  • 2回复

救急,关于QGraphicsScene及其相关类的问题 [复制链接]

上一主题 下一主题
离线山间轻风
 
只看楼主 倒序阅读 楼主  发表于: 2010-03-26
请问一下,用QGraphicsScene及相关类做界面时,我在界面上放了张图,想实现点击图片让图片隐藏的功能,为什么一直不认鼠标按下的事件呢?是需要重写什么函数吗?
最近急着要用这个。
离线nmiirq

只看该作者 1楼 发表于: 2010-03-27
void QGraphicsScene::mouseMoveEvent ( QGraphicsSceneMouseEvent * mouseEvent )   [virtual protected]

This event handler, for event mouseEvent, can be reimplemented in a subclass to receive mouse move events for the scene.

The default implementation depends on the mouse grabber state. If there is a mouse grabber item, the event is sent to the mouse grabber. If there are any items that accept hover events at the current position, the event is translated into a hover event and accepted; otherwise it's ignored.

See also QGraphicsItem::mousePressEvent(), QGraphicsItem::mouseReleaseEvent(), QGraphicsItem::mouseDoubleClickEvent(), and QGraphicsItem::setAcceptedMouseButtons().
离线山间轻风
只看该作者 2楼 发表于: 2010-03-29
谢谢,非常感谢,知道怎么做了
快速回复
限100 字节
 
上一个 下一个