关于Qt:GraphicsScene中有时无法捕捉mousemoveEvents

omegafish 2010-06-12 04:45:08
大牛们好!
先说下我的运行环境:window xp上装的虚拟机redhat 5。qt跑在redhat 5 里面。
做了一个qt程序,在QtGraphicsScene中捕捉了mousemoveEvents(无需按下左键)。实验时发现大部分时候程序正常,能够捕捉到这个事件。但是有的时候我明明移动了鼠标却没有进入相应的事件处理。通过调试发现,这种状况鼠标虽然移动,但是scene没有成功捕捉到。请问解决办法!!!!
谢谢,100分送上!

...全文
134 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
tingsking18 2010-06-17
  • 打赏
  • 举报
回复
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.
omegafish 2010-06-17
  • 打赏
  • 举报
回复
言之有理,我查下,如果能够解决,100分送上!
gemfield 2010-06-13
  • 打赏
  • 举报
回复
mousemoveEvents有个属性是设置最低像素值,也就是最少移动多少个像素才会触发
dext 2010-06-13
  • 打赏
  • 举报
回复
QWidget::setMouseTracking(bool enable);
vanchristin 2010-06-12
  • 打赏
  • 举报
回复
[Quote=引用楼主 omegafish 的回复:]
大牛们好!
先说下我的运行环境:window xp上装的虚拟机redhat 5。qt跑在redhat 5 里面。
做了一个qt程序,在QtGraphicsScene中捕捉了mousemoveEvents(无需按下左键)。实验时发现大部分时候程序正常,能够捕捉到这个事件。但是有的时候我明明移动了鼠标却没有进入相应的事件处理。通过调试发现,这种状况鼠标虽然移动,但是scene没有成功捕……
[/Quote]

有的时候是什么时候,和大部分时候有什么不一样的情况?
sunboyqq23 2010-06-12
  • 打赏
  • 举报
回复
顶。。。

16,216

社区成员

发帖
与我相关
我的任务
社区描述
Qt 是一个跨平台应用程序框架。通过使用 Qt,您可以一次性开发应用程序和用户界面,然后将其部署到多个桌面和嵌入式操作系统,而无需重复编写源代码。
社区管理员
  • Qt
  • 亭台六七座
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧