summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/kernel/qwindow.cpp17
-rw-r--r--src/gui/kernel/qwindow_p.h2
2 files changed, 11 insertions, 8 deletions
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index 94a34b5c27..7ab2d31b86 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -2559,26 +2559,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
diff --git a/src/gui/kernel/qwindow_p.h b/src/gui/kernel/qwindow_p.h
index b8a9f5d3de..c1955be6b6 100644
--- a/src/gui/kernel/qwindow_p.h
+++ b/src/gui/kernel/qwindow_p.h
@@ -118,7 +118,7 @@ public:
void maybeQuitOnLastWindowClosed();
#ifndef QT_NO_CURSOR
void setCursor(const QCursor *c = 0);
- void applyCursor();
+ bool applyCursor();
#endif
void deliverUpdateRequest();