mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
Refactor cursor: pointer event filter
This commit is contained in:
parent
7d1e8e99f4
commit
2c0a1dd298
1 changed files with 12 additions and 20 deletions
|
@ -345,12 +345,7 @@ class AnkiApp(QApplication):
|
|||
##################################################
|
||||
|
||||
def eventFilter(self, src: Any, evt: QEvent) -> bool:
|
||||
if evt.type() in [QEvent.Type.Enter, QEvent.Type.HoverEnter]:
|
||||
if (
|
||||
(
|
||||
isinstance(
|
||||
src,
|
||||
(
|
||||
pointer_classes = (
|
||||
QPushButton,
|
||||
QCheckBox,
|
||||
QRadioButton,
|
||||
|
@ -358,14 +353,11 @@ class AnkiApp(QApplication):
|
|||
# classes with PyQt5 compatibility proxy
|
||||
without_qt5_compat_wrapper(QToolButton),
|
||||
without_qt5_compat_wrapper(QTabBar),
|
||||
),
|
||||
)
|
||||
)
|
||||
and src.isEnabled()
|
||||
or (
|
||||
if evt.type() in [QEvent.Type.Enter, QEvent.Type.HoverEnter]:
|
||||
if (isinstance(src, pointer_classes) and src.isEnabled()) or (
|
||||
isinstance(src, without_qt5_compat_wrapper(QComboBox))
|
||||
and not src.isEditable()
|
||||
)
|
||||
):
|
||||
self.setOverrideCursor(QCursor(Qt.CursorShape.PointingHandCursor))
|
||||
else:
|
||||
|
|
Loading…
Reference in a new issue