Merge pull request #960 from ixjlyons/fix-busycursor-pyside
Work around PySide setOverrideCursor bug in BusyCursor
This commit is contained in:
commit
f3ab88001d
@ -1,4 +1,4 @@
|
||||
from ..Qt import QtGui, QtCore
|
||||
from ..Qt import QtGui, QtCore, QT_LIB
|
||||
|
||||
__all__ = ['BusyCursor']
|
||||
|
||||
@ -17,7 +17,12 @@ class BusyCursor(object):
|
||||
app = QtCore.QCoreApplication.instance()
|
||||
isGuiThread = (app is not None) and (QtCore.QThread.currentThread() == app.thread())
|
||||
if isGuiThread and QtGui.QApplication.instance() is not None:
|
||||
QtGui.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.WaitCursor))
|
||||
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))
|
||||
BusyCursor.active.append(self)
|
||||
self._active = True
|
||||
else:
|
||||
@ -27,4 +32,3 @@ class BusyCursor(object):
|
||||
if self._active:
|
||||
BusyCursor.active.pop(-1)
|
||||
QtGui.QApplication.restoreOverrideCursor()
|
||||
|
Loading…
Reference in New Issue
Block a user