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