def set_override_cursor( override: bool, override_cursor: Qt.CursorShape = Qt.SizeAllCursor) -> None: """ Sets the override cursor if an override cursor doesn't exist. Otherwise, restores the override cursor :param override: A boolean for whether to set the override cursor or not :param override_cursor: The override cursor to use if the override parameter is true """ cursor = QApplication.overrideCursor() if override and cursor is None: QApplication.setOverrideCursor(QCursor(override_cursor)) elif not override and cursor is not None: QApplication.restoreOverrideCursor()
def overrideCursor(self, cursor): old_cursor = QApplication.overrideCursor() if old_cursor == None or old_cursor != cursor: QApplication.restoreOverrideCursor() QApplication.setOverrideCursor(cursor) self._curCursor = cursor