QT添加全局手势的界面双指触摸出现打印TouchPointPressed without previous release event

「已注销」 2019-08-21 05:57:38
问题描述:
1 在有全局手势的界面双指触摸出现打印信息TouchPointPressed without previous release event
2 在有全局手势的界面单指触摸正常
3 在没有全局手势的界面单双指触摸正常

请问是什么原因导致出现这个打印信息,应该如何避免呢?

出现打印信息的函数:

QQuickPointerEvent *QQuickPointerTouchEvent::reset(QEvent *event)
{
auto ev = static_cast<QTouchEvent*>(event);
m_event = ev;
if (!event)
return this;

m_device = QQuickPointerDevice::touchDevice(ev->device());
m_button = Qt::NoButton;
m_pressedButtons = Qt::NoButton;

const QList<QTouchEvent::TouchPoint> &tps = ev->touchPoints();
int newPointCount = tps.count();
m_touchPoints.reserve(newPointCount);

for (int i = m_touchPoints.size(); i < newPointCount; ++i)
m_touchPoints.insert(i, new QQuickEventTouchPoint(this));

// Make sure the grabbers are right from one event to the next
QVector<QQuickItem*> grabbers;
// Copy all grabbers, because the order of points might have changed in the event.
// The ID is all that we can rely on (release might remove the first point etc).
for (int i = 0; i < newPointCount; ++i) {
QQuickItem *grabber = nullptr;
if (auto point = pointById(tps.at(i).id()))
grabber = point->grabber();
grabbers.append(grabber);
}

bool b = false;
for (int i = 0; i < newPointCount; ++i) {
auto point = m_touchPoints.at(i);
point->reset(tps.at(i), ev->timestamp());
if (point->state() == QQuickEventPoint::Pressed) {
if (grabbers.at(i))
{
qWarning() << "TouchPointPressed without previous release event" << point;
b = true;
}
point->setGrabber(nullptr);
} else {
point->setGrabber(grabbers.at(i));
}
}
m_pointCount = newPointCount;
if (b)
{
qWarning() << "Re-Send the release event!!";

emit qGuiApp->applicationStateChanged(Qt::ApplicationInactive);
emit qGuiApp->applicationStateChanged(Qt::ApplicationActive);
}
return this;
}
...全文
742 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

64,648

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

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