mirror of
https://github.com/LC044/WeChatMsg
synced 2024-11-14 22:01:54 +08:00
修复等待光标异常的问题
This commit is contained in:
parent
f405fb9f6f
commit
1209caa378
@ -38,25 +38,34 @@ class QCursorGif:
|
|||||||
self._cursorTimeout = 200
|
self._cursorTimeout = 200
|
||||||
self._cursorTimer = QTimer(parent)
|
self._cursorTimer = QTimer(parent)
|
||||||
self._cursorTimer.timeout.connect(self._doBusy)
|
self._cursorTimer.timeout.connect(self._doBusy)
|
||||||
|
self.num = 0
|
||||||
|
|
||||||
def _doBusy(self):
|
def _doBusy(self):
|
||||||
if self._cursorIndex > self._cursorCount:
|
if self._cursorIndex > self._cursorCount:
|
||||||
self._cursorIndex = 0
|
self._cursorIndex = 0
|
||||||
QApplication.instance().setOverrideCursor(
|
QApplication.setOverrideCursor(
|
||||||
self._cursorImages[self._cursorIndex])
|
self._cursorImages[self._cursorIndex])
|
||||||
self._cursorIndex += 1
|
self._cursorIndex += 1
|
||||||
|
self.num += 1
|
||||||
|
|
||||||
def startBusy(self):
|
def startBusy(self):
|
||||||
|
# QApplication.setOverrideCursor(Qt.WaitCursor)
|
||||||
if not self._cursorTimer.isActive():
|
if not self._cursorTimer.isActive():
|
||||||
self._cursorTimer.start(self._cursorTimeout)
|
self._cursorTimer.start(self._cursorTimeout)
|
||||||
|
|
||||||
def stopBusy(self):
|
def stopBusy(self):
|
||||||
self._cursorTimer.stop()
|
self._cursorTimer.stop()
|
||||||
QApplication.instance().setOverrideCursor(self._oldCursor)
|
QApplication.restoreOverrideCursor()
|
||||||
|
# 将光标出栈,恢复至原始状态
|
||||||
|
for i in range(self.num):
|
||||||
|
QApplication.restoreOverrideCursor()
|
||||||
|
self.num = 0
|
||||||
|
|
||||||
|
|
||||||
def setCursorTimeout(self, timeout):
|
def setCursorTimeout(self, timeout):
|
||||||
self._cursorTimeout = timeout
|
self._cursorTimeout = timeout
|
||||||
|
|
||||||
def setOldCursor(self, parent=None):
|
def setOldCursor(self, parent=None):
|
||||||
self._oldCursor = (parent.cursor() or Qt.ArrowCursor) if parent else (
|
QApplication.overrideCursor()
|
||||||
QApplication.instance().overrideCursor() or Qt.ArrowCursor)
|
self._oldCursor = (QApplication.overrideCursor() or parent.cursor() or Qt.ArrowCursor or Qt.IBeamCursor) if parent else (
|
||||||
|
QApplication.overrideCursor() or Qt.ArrowCursor)
|
||||||
|
@ -35,8 +35,6 @@ QWidget{
|
|||||||
QListWidget, QListView, QTreeWidget, QTreeView {
|
QListWidget, QListView, QTreeWidget, QTreeView {
|
||||||
outline: 0px;
|
outline: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QMenu::item:selected {
|
QMenu::item:selected {
|
||||||
color: black;
|
color: black;
|
||||||
background: rgb(230, 235, 240);
|
background: rgb(230, 235, 240);
|
||||||
@ -83,7 +81,7 @@ class MainWinController(QMainWindow, mainwindow.Ui_MainWindow,QCursorGif):
|
|||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
# 设置忙碌光标图片数组
|
# 设置忙碌光标图片数组
|
||||||
self.initCursor([':/icons/icons/Cursors/%d.png' %
|
self.initCursor([':/icons/icons/Cursors/%d.png' %
|
||||||
i for i in range(8)], self)
|
i for i in range(8)])
|
||||||
self.setCursorTimeout(100)
|
self.setCursorTimeout(100)
|
||||||
# self.setWindowIcon(Icon.MainWindow_Icon)
|
# self.setWindowIcon(Icon.MainWindow_Icon)
|
||||||
pixmap = QPixmap(Icon.logo_ico_path)
|
pixmap = QPixmap(Icon.logo_ico_path)
|
||||||
|
@ -14,16 +14,19 @@ from PyQt5 import QtCore, QtGui, QtWidgets
|
|||||||
class Ui_MainWindow(object):
|
class Ui_MainWindow(object):
|
||||||
def setupUi(self, MainWindow):
|
def setupUi(self, MainWindow):
|
||||||
MainWindow.setObjectName("MainWindow")
|
MainWindow.setObjectName("MainWindow")
|
||||||
MainWindow.resize(1280, 779)
|
MainWindow.resize(605, 553)
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setFamily("微软雅黑")
|
font.setFamily("微软雅黑")
|
||||||
font.setPointSize(12)
|
font.setPointSize(12)
|
||||||
font.setBold(False)
|
font.setBold(False)
|
||||||
font.setWeight(50)
|
font.setWeight(50)
|
||||||
MainWindow.setFont(font)
|
MainWindow.setFont(font)
|
||||||
|
MainWindow.setMouseTracking(True)
|
||||||
MainWindow.setStyleSheet("")
|
MainWindow.setStyleSheet("")
|
||||||
MainWindow.setIconSize(QtCore.QSize(50, 24))
|
MainWindow.setIconSize(QtCore.QSize(50, 24))
|
||||||
|
MainWindow.setDockOptions(QtWidgets.QMainWindow.AllowTabbedDocks|QtWidgets.QMainWindow.AnimatedDocks)
|
||||||
self.centralwidget = QtWidgets.QWidget(MainWindow)
|
self.centralwidget = QtWidgets.QWidget(MainWindow)
|
||||||
|
self.centralwidget.setMouseTracking(True)
|
||||||
self.centralwidget.setObjectName("centralwidget")
|
self.centralwidget.setObjectName("centralwidget")
|
||||||
self.horizontalLayout = QtWidgets.QHBoxLayout(self.centralwidget)
|
self.horizontalLayout = QtWidgets.QHBoxLayout(self.centralwidget)
|
||||||
self.horizontalLayout.setContentsMargins(10, 0, 0, 0)
|
self.horizontalLayout.setContentsMargins(10, 0, 0, 0)
|
||||||
@ -70,7 +73,7 @@ class Ui_MainWindow(object):
|
|||||||
self.horizontalLayout.addWidget(self.stackedWidget)
|
self.horizontalLayout.addWidget(self.stackedWidget)
|
||||||
MainWindow.setCentralWidget(self.centralwidget)
|
MainWindow.setCentralWidget(self.centralwidget)
|
||||||
self.menubar = QtWidgets.QMenuBar(MainWindow)
|
self.menubar = QtWidgets.QMenuBar(MainWindow)
|
||||||
self.menubar.setGeometry(QtCore.QRect(0, 0, 1280, 27))
|
self.menubar.setGeometry(QtCore.QRect(0, 0, 605, 27))
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setFamily("微软雅黑")
|
font.setFamily("微软雅黑")
|
||||||
font.setPointSize(12)
|
font.setPointSize(12)
|
||||||
|
Loading…
Reference in New Issue
Block a user