QTouchEvent 在 Windows 8 下无法使用 Qt 4.7.4 触发?
我在配备 4 点触摸屏的 Acer W501 x86 平板电脑上运行的 Windows 8 下遇到 QT 触摸/多点触摸支持问题。
我有一个 QGraphicsView 小部件,我已经完成了
setAttribute(Qt::WA_AcceptTouchEvents);
该小部件的父级有一个 eventFilter 方法:
bool MyGUI::eventFilter(QObject* pObject, QEvent* pEvent)
{
QEvent::Type eType = pEvent->type();
if (pObject == _uiWindow._multitouchArea)
{
if ((eType == QEvent::TouchBegin) || (eType == QEvent::TouchEnd) || (eType == QEvent::TouchUpdate))
{
// invoke multi touch event handling here
_handleTouchEvent(pEvent);
}
else if ((eType == QEvent::MouseButtonPress) || (eType == QEvent::MouseButtonRelease) || (eType == QEvent::MouseMove))
{
// invoke mouse based handling here
_handleMouseEvent(pEvent);
}
}
else
{
return pObject->event(pEvent);
}
return false;
}
它安装在 QGraphicsViewWidget 上。
现在我明白 Qt 默认情况下将单点触摸事件解释为鼠标事件并将它们发送到应用程序。但是,无论我多么努力地将触摸屏与我的身体的任何部分混合在一起,我都无法触发任何 TouchBegin/TouchUpdate/TouchEnd 事件...
我在这里缺少什么吗?
谢谢大家!
I am having an issue with QT touch/multitouch support under Windows 8 running on an Acer W501 x86 tablet with a 4-point touch screen.
I have a QGraphicsView widget on which I've done
setAttribute(Qt::WA_AcceptTouchEvents);
The widget's parent has an eventFilter method:
bool MyGUI::eventFilter(QObject* pObject, QEvent* pEvent)
{
QEvent::Type eType = pEvent->type();
if (pObject == _uiWindow._multitouchArea)
{
if ((eType == QEvent::TouchBegin) || (eType == QEvent::TouchEnd) || (eType == QEvent::TouchUpdate))
{
// invoke multi touch event handling here
_handleTouchEvent(pEvent);
}
else if ((eType == QEvent::MouseButtonPress) || (eType == QEvent::MouseButtonRelease) || (eType == QEvent::MouseMove))
{
// invoke mouse based handling here
_handleMouseEvent(pEvent);
}
}
else
{
return pObject->event(pEvent);
}
return false;
}
which is installed on the QGraphicsViewWidget.
Now I understand that Qt by default interprets single point touch events as mouse events and sends them to the application like that. However, I've been unable to trigger any TouchBegin/TouchUpdate/TouchEnd events whatsoever no matter how hard I mash the touch screen with any part(s) of my anatomy...
Is there something that I am missing here?
Thank you all!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否尝试在图形视图的 viewport() 上安装事件过滤器?
这是事件发送的地方。
Did you try installing the event filter on the viewport() of the graphicsview?
This is where the events are sent.