Combine all event filters in one module, and apply the status tip filter to the sidebar as well
This commit is contained in:
+14
-4
@@ -1,9 +1,10 @@
|
||||
"""
|
||||
novelWriter – Custom Object: Wheel Event Filter
|
||||
===============================================
|
||||
novelWriter – Custom Objects: Event Filters
|
||||
===========================================
|
||||
|
||||
File History:
|
||||
Created: 2023-08-31 [2.1rc1]
|
||||
Created: 2023-08-31 [2.1rc1] WheelEventFilter
|
||||
Created: 2023-11-28 [2.2] StatusTipFilter
|
||||
|
||||
This file is a part of novelWriter
|
||||
Copyright 2018–2023, Veronica Berglyd Olsen
|
||||
@@ -23,7 +24,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
from PyQt5.QtGui import QWheelEvent
|
||||
from PyQt5.QtGui import QStatusTipEvent, QWheelEvent
|
||||
from PyQt5.QtCore import QEvent, QObject
|
||||
from PyQt5.QtWidgets import QWidget
|
||||
|
||||
@@ -63,3 +64,12 @@ class WheelEventFilter(QObject):
|
||||
return False
|
||||
|
||||
# END Class WheelEventFilter
|
||||
|
||||
|
||||
class StatusTipFilter(QObject):
|
||||
|
||||
def eventFilter(self, obj: QObject, event: QEvent) -> bool:
|
||||
"""Filter out status tip events on menus."""
|
||||
return True if isinstance(event, QStatusTipEvent) else super().eventFilter(obj, event)
|
||||
|
||||
# END Class StatusTipFilter
|
||||
Reference in New Issue
Block a user