Combine all event filters in one module, and apply the status tip filter to the sidebar as well

This commit is contained in:
Veronica Berglyd Olsen
2023-11-29 16:05:58 +01:00
parent b526315084
commit 1118f01c91
6 changed files with 27 additions and 24 deletions
@@ -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 20182023, 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