diff options
author | Jørgen Lind <jorgen.lind@nokia.com> | 2012-01-10 08:14:36 +0100 |
---|---|---|
committer | Samuel Rødal <samuel.rodal@nokia.com> | 2012-01-10 15:57:25 +0100 |
commit | c0778031e9e7928fffdb395fca0a16aeab4c726f (patch) | |
tree | 2d61b2ff2cd0310e022d21d30a99307daafdf613 /examples | |
parent | 4bc11818cf546a522785163f99a7051210e3174c (diff) | |
download | qtwayland-c0778031e9e7928fffdb395fca0a16aeab4c726f.tar.gz |
Handle changeCursor in QWindowCompositor
Change-Id: I8ef3b9b36aad00177170f98bcc5c832f884bab04
Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/qwindow-compositor/qwindowcompositor.cpp | 12 | ||||
-rw-r--r-- | examples/qwindow-compositor/qwindowcompositor.h | 2 |
2 files changed, 14 insertions, 0 deletions
diff --git a/examples/qwindow-compositor/qwindowcompositor.cpp b/examples/qwindow-compositor/qwindowcompositor.cpp index bb2c0d0b..b502dc2b 100644 --- a/examples/qwindow-compositor/qwindowcompositor.cpp +++ b/examples/qwindow-compositor/qwindowcompositor.cpp @@ -88,6 +88,18 @@ QPointF QWindowCompositor::toSurface(WaylandSurface *surface, const QPointF &pos return pos - surface->pos(); } +void QWindowCompositor::changeCursor(const QImage &image, int hotspotX, int hotspotY) +{ + QCursor cursor(QPixmap::fromImage(image),hotspotX,hotspotY); + static bool cursroIsSet = false; + if (cursroIsSet) { + QGuiApplication::changeOverrideCursor(cursor); + } else { + QGuiApplication::setOverrideCursor(cursor); + cursroIsSet = true; + } +} + WaylandSurface *QWindowCompositor::surfaceAt(const QPoint &point, QPoint *local) { for (int i = m_surfaces.size() - 1; i >= 0; --i) { diff --git a/examples/qwindow-compositor/qwindowcompositor.h b/examples/qwindow-compositor/qwindowcompositor.h index de01c524..5ece4c25 100644 --- a/examples/qwindow-compositor/qwindowcompositor.h +++ b/examples/qwindow-compositor/qwindowcompositor.h @@ -34,6 +34,8 @@ protected: bool eventFilter(QObject *obj, QEvent *event); QPointF toSurface(WaylandSurface *surface, const QPointF &pos) const; + void changeCursor(const QImage &image, int hotspotX, int hotspotY); + private: QOpenGLWindow *m_window; QImage m_backgroundImage; |