Merge pull request #960 from ixjlyons/fix-busycursor-pyside

Work around PySide setOverrideCursor bug in BusyCursor
This commit is contained in:
Ogi Moore 2019-06-24 16:04:37 -07:00 committed by GitHub
commit f3ab88001d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,4 +1,4 @@
from ..Qt import QtGui, QtCore from ..Qt import QtGui, QtCore, QT_LIB
__all__ = ['BusyCursor'] __all__ = ['BusyCursor']
@ -17,6 +17,11 @@ class BusyCursor(object):
app = QtCore.QCoreApplication.instance() app = QtCore.QCoreApplication.instance()
isGuiThread = (app is not None) and (QtCore.QThread.currentThread() == app.thread()) isGuiThread = (app is not None) and (QtCore.QThread.currentThread() == app.thread())
if isGuiThread and QtGui.QApplication.instance() is not None: if isGuiThread and QtGui.QApplication.instance() is not None:
if QT_LIB == 'PySide':
# pass CursorShape rather than QCursor for PySide
# see https://bugreports.qt.io/browse/PYSIDE-243
QtGui.QApplication.setOverrideCursor(QtCore.Qt.WaitCursor)
else:
QtGui.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.WaitCursor)) QtGui.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.WaitCursor))
BusyCursor.active.append(self) BusyCursor.active.append(self)
self._active = True self._active = True
@ -27,4 +32,3 @@ class BusyCursor(object):
if self._active: if self._active:
BusyCursor.active.pop(-1) BusyCursor.active.pop(-1)
QtGui.QApplication.restoreOverrideCursor() QtGui.QApplication.restoreOverrideCursor()