summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2020-06-25 15:04:20 +0200
committerLiang Qi <liang.qi@qt.io>2020-06-26 10:46:20 +0200
commitbad18e2db95a399e350b890a0cd084d53c1e2ae8 (patch)
tree9af16cdafdb00252df807cf4db8572318cd4d5aa /examples
parent04ed6ad3fc9816947dfe1b3924ca2f109372408c (diff)
downloadqtwayland-bad18e2db95a399e350b890a0cd084d53c1e2ae8.tar.gz
Adapt to new QPointingDevice API
QTouchDevice has been replaced with a more general QPointingDevice. All input devices need detailed information and need to be registered via QWindowSystemInterface::registerInputDevice(). This patch is not doing that yet; it's just enough to get qtwayland to compile again. Done-With: Liang Qi <liang.qi@qt.io> Change-Id: Id3a2e475ed07294a1977004fc72b11e466acc216 Reviewed-by: Liang Qi <liang.qi@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'examples')
-rw-r--r--examples/wayland/minimal-cpp/window.cpp6
-rw-r--r--examples/wayland/qwindow-compositor/compositor.cpp4
-rw-r--r--examples/wayland/qwindow-compositor/window.cpp24
3 files changed, 17 insertions, 17 deletions
diff --git a/examples/wayland/minimal-cpp/window.cpp b/examples/wayland/minimal-cpp/window.cpp
index 9f22cc68..4d1c1a89 100644
--- a/examples/wayland/minimal-cpp/window.cpp
+++ b/examples/wayland/minimal-cpp/window.cpp
@@ -114,17 +114,17 @@ void Window::paintGL()
void Window::mousePressEvent(QMouseEvent *event)
{
- m_compositor->handleMousePress(event->localPos().toPoint(), event->button());
+ m_compositor->handleMousePress(event->position().toPoint(), event->button());
}
void Window::mouseReleaseEvent(QMouseEvent *event)
{
- m_compositor->handleMouseRelease(event->localPos().toPoint(), event->button(), event->buttons());
+ m_compositor->handleMouseRelease(event->position().toPoint(), event->button(), event->buttons());
}
void Window::mouseMoveEvent(QMouseEvent *event)
{
- m_compositor->handleMouseMove(event->localPos().toPoint());
+ m_compositor->handleMouseMove(event->position().toPoint());
}
void Window::wheelEvent(QWheelEvent *event)
diff --git a/examples/wayland/qwindow-compositor/compositor.cpp b/examples/wayland/qwindow-compositor/compositor.cpp
index 220ea3d7..72f23ce6 100644
--- a/examples/wayland/qwindow-compositor/compositor.cpp
+++ b/examples/wayland/qwindow-compositor/compositor.cpp
@@ -461,7 +461,7 @@ void Compositor::handleMouseEvent(QWaylandView *target, QMouseEvent *me)
seat->sendMouseReleaseEvent(me->button());
break;
case QEvent::MouseMove:
- seat->sendMouseMoveEvent(target, me->localPos(), me->globalPos());
+ seat->sendMouseMoveEvent(target, me->position(), me->globalPosition());
default:
break;
}
@@ -496,7 +496,7 @@ void Compositor::startDrag()
void Compositor::handleDrag(View *target, QMouseEvent *me)
{
- QPointF pos = me->localPos();
+ QPointF pos = me->position();
QWaylandSurface *surface = nullptr;
if (target) {
pos -= target->position();
diff --git a/examples/wayland/qwindow-compositor/window.cpp b/examples/wayland/qwindow-compositor/window.cpp
index c439d20a..34066f42 100644
--- a/examples/wayland/qwindow-compositor/window.cpp
+++ b/examples/wayland/qwindow-compositor/window.cpp
@@ -198,7 +198,7 @@ void Window::mousePressEvent(QMouseEvent *e)
if (mouseGrab())
return;
if (m_mouseView.isNull()) {
- m_mouseView = viewAt(e->localPos());
+ m_mouseView = viewAt(e->position());
if (!m_mouseView) {
m_compositor->closePopups();
return;
@@ -207,10 +207,10 @@ void Window::mousePressEvent(QMouseEvent *e)
m_grabState = MoveGrab; //start move
else
m_compositor->raise(m_mouseView);
- m_initialMousePos = e->localPos();
- m_mouseOffset = e->localPos() - m_mouseView->position();
+ m_initialMousePos = e->position();
+ m_mouseOffset = e->position() - m_mouseView->position();
- QMouseEvent moveEvent(QEvent::MouseMove, e->localPos(), e->globalPos(), Qt::NoButton, Qt::NoButton, e->modifiers());
+ QMouseEvent moveEvent(QEvent::MouseMove, e->position(), e->globalPosition(), Qt::NoButton, Qt::NoButton, e->modifiers());
sendMouseEvent(&moveEvent, m_mouseView);
}
sendMouseEvent(e, m_mouseView);
@@ -222,7 +222,7 @@ void Window::mouseReleaseEvent(QMouseEvent *e)
sendMouseEvent(e, m_mouseView);
if (e->buttons() == Qt::NoButton) {
if (m_grabState == DragGrab) {
- View *view = viewAt(e->localPos());
+ View *view = viewAt(e->position());
m_compositor->handleDrag(view, e);
}
m_mouseView = nullptr;
@@ -234,27 +234,27 @@ void Window::mouseMoveEvent(QMouseEvent *e)
{
switch (m_grabState) {
case NoGrab: {
- View *view = m_mouseView ? m_mouseView.data() : viewAt(e->localPos());
+ View *view = m_mouseView ? m_mouseView.data() : viewAt(e->position());
sendMouseEvent(e, view);
if (!view)
setCursor(Qt::ArrowCursor);
}
break;
case MoveGrab: {
- m_mouseView->setPosition(e->localPos() - m_mouseOffset);
+ m_mouseView->setPosition(e->position() - m_mouseOffset);
update();
}
break;
case ResizeGrab: {
- QPoint delta = (e->localPos() - m_initialMousePos).toPoint();
+ QPoint delta = (e->position() - m_initialMousePos).toPoint();
m_compositor->handleResize(m_mouseView, m_initialSize, delta, m_resizeEdge);
}
break;
case DragGrab: {
- View *view = viewAt(e->localPos());
+ View *view = viewAt(e->position());
m_compositor->handleDrag(view, e);
if (m_dragIconView) {
- m_dragIconView->setPosition(e->localPos() + m_dragIconView->offset());
+ m_dragIconView->setPosition(e->position() + m_dragIconView->offset());
update();
}
}
@@ -264,10 +264,10 @@ void Window::mouseMoveEvent(QMouseEvent *e)
void Window::sendMouseEvent(QMouseEvent *e, View *target)
{
- QPointF mappedPos = e->localPos();
+ QPointF mappedPos = e->position();
if (target)
mappedPos -= target->position();
- QMouseEvent viewEvent(e->type(), mappedPos, e->localPos(), e->button(), e->buttons(), e->modifiers());
+ QMouseEvent viewEvent(e->type(), mappedPos, e->position(), e->button(), e->buttons(), e->modifiers());
m_compositor->handleMouseEvent(target, &viewEvent);
}