Bläddra i källkod

OSX: set the mouse cursor to blank in addition to hiding

This changes OSX behavior to the same as the "portable" one, just that
on OSX also NSCursor hide/unhide is called.

Not entirely comfortable with this, because if the NSCursor method
doesn't work, it will appear as if everything is ok. But the cursor
could still become visible on notifications _if_ NSCursor fails, which
would be quite annoying.
Vincent Lang 8 år sedan
förälder
incheckning
f2c4b49c8a
1 ändrade filer med 6 tillägg och 5 borttagningar
  1. 6 5
      src/system/SystemComponent.cpp

+ 6 - 5
src/system/SystemComponent.cpp

@@ -191,19 +191,20 @@ void SystemComponent::setCursorVisibility(bool visible)
   m_cursorVisible = visible;
 
   if (visible)
+  {
+    qApp->restoreOverrideCursor();
     m_mouseOutTimer->start(MOUSE_TIMEOUT);
+  }
   else
+  {
+    qApp->setOverrideCursor(QCursor(Qt::BlankCursor));
     m_mouseOutTimer->stop();
+  }
 
 #ifdef Q_OS_MAC
   // OSX notifications will reset the cursor image (without Qt's knowledge). The
   // only thing we can do override this is using Cocoa's native cursor hiding.
   OSXUtils::SetCursorVisible(visible);
-#else
-  if (visible)
-    qApp->restoreOverrideCursor();
-  else
-    qApp->setOverrideCursor(QCursor(Qt::BlankCursor));
 #endif
 }