Fix backward compatibility with Qt 5.6

This commit is contained in:
Vladyslav Stelmakhovskyi 2017-06-18 10:54:59 +02:00
parent a1475bc65f
commit f34faa3ee7

View file

@ -446,12 +446,21 @@ void Web3DOverlay::handlePointerEventAsTouch(const PointerEvent& event) {
//
// In Qt 5.9 mouse events must be sent before touch events to make sure some QtQuick components will
// receive mouse events
#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
if (!(this->_pressed && event.getType() == PointerEvent::Move)) {
QMouseEvent* mouseEvent = new QMouseEvent(mouseType, windowPoint, windowPoint, windowPoint, button, buttons, Qt::NoModifier);
QCoreApplication::postEvent(_webSurface->getWindow(), mouseEvent);
}
#endif
QCoreApplication::postEvent(_webSurface->getWindow(), touchEvent);
#if QT_VERSION < QT_VERSION_CHECK(5, 9, 0)
if (this->_pressed && event.getType() == PointerEvent::Move) {
return;
}
QMouseEvent* mouseEvent = new QMouseEvent(mouseType, windowPoint, windowPoint, windowPoint, button, buttons, Qt::NoModifier);
QCoreApplication::postEvent(_webSurface->getWindow(), mouseEvent);
#endif
}
void Web3DOverlay::handlePointerEventAsMouse(const PointerEvent& event) {