瀏覽代碼

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 年之前
父節點
當前提交
f2c4b49c8a
共有 1 個文件被更改,包括 6 次插入5 次删除
  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
 }