diff options
author | Liang Qi <liang.qi@qt.io> | 2017-03-21 19:07:53 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2017-03-21 19:07:53 +0100 |
commit | 65faf4565595d91996ddec4af25af5e97c7f0317 (patch) | |
tree | a7415e90db3fa1e46f638e1c31d2f2b9a5d0ec4a /src/gui/kernel/qwindow.cpp | |
parent | a9383ef99a29c333a1edd32695ddc29ea0ba805d (diff) | |
parent | 26bc4ac5cb56ce8f2d3d10125fa9c6a72140573a (diff) |
Merge remote-tracking branch 'origin/5.8' into 5.9
Conflicts:
src/plugins/platforms/eglfs/eglfs-plugin.pro
Change-Id: Id76cdbb41b7758572a3b8ea4dcb40d49bac968db
Diffstat (limited to 'src/gui/kernel/qwindow.cpp')
-rw-r--r-- | src/gui/kernel/qwindow.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index c94ea0922a..d44bfabc04 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -2697,26 +2697,29 @@ void QWindowPrivate::setCursor(const QCursor *newCursor) cursor = QCursor(Qt::ArrowCursor); hasCursor = false; } - // Only attempt to set cursor and emit signal if there is an actual platform cursor - QScreen* screen = q->screen(); - if (screen && screen->handle()->cursor()) { - applyCursor(); + // Only attempt to emit signal if there is an actual platform cursor + if (applyCursor()) { QEvent event(QEvent::CursorChange); QGuiApplication::sendEvent(q, &event); } } -void QWindowPrivate::applyCursor() +// Apply the cursor and returns true iff the platform cursor exists +bool QWindowPrivate::applyCursor() { Q_Q(QWindow); - if (platformWindow) { - if (QPlatformCursor *platformCursor = q->screen()->handle()->cursor()) { + if (QScreen *screen = q->screen()) { + if (QPlatformCursor *platformCursor = screen->handle()->cursor()) { + if (!platformWindow) + return true; QCursor *c = QGuiApplication::overrideCursor(); if (!c && hasCursor) c = &cursor; platformCursor->changeCursor(c, q); + return true; } } + return false; } #endif // QT_NO_CURSOR |