首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > QT开发 >

QMainWindow不响应mouseReleaseEvent事件,该怎么解决

2012-06-14 
QMainWindow不响应mouseReleaseEvent事件建的一个QMainWindow只能响应mousePressEvent事件,却不能够响应mo

QMainWindow不响应mouseReleaseEvent事件
建的一个QMainWindow只能响应mousePressEvent事件,却不能够响应mouseReleaseEvent事件和mouseMoveEvent事件,请问这是怎么回事?

[解决办法]
QMainWindow只能响应mousePressEvent事件,却不能够响应mouseReleaseEvent事件?
这个是不可能的。

mouseMoveEvent是需要将左键按下移动鼠标才有的。
[解决办法]
QWidget

mouseTracking : bool
This property holds whether mouse tracking is enabled for the widget.

If mouse tracking is disabled (the default), the widget only receives mouse move events when at least one mouse button is pressed while the mouse is being moved.

If mouse tracking is enabled, the widget receives mouse move events even if no buttons are pressed.

Access functions:

boolhasMouseTracking () const
voidsetMouseTracking ( bool enable )
See also mouseMoveEvent().
[解决办法]
3楼正解。

楼主最好把代码贴出来,分析下。

热点排行