mirror of
https://github.com/m-labs/artiq.git
synced 2024-12-25 11:18:27 +08:00
gui: don't scroll experiment editor on modified wheel (closes #303)
If you try to target e.g. spinbox with a ctrl- or shift-wheel to change the value and you don't aim well, the tree widget will scroll. We already have tree scroll on unmodified wheel. Let's have the modified wheel events exclusively target the smaller widgets.
This commit is contained in:
parent
41ca223c45
commit
c08881de5d
@ -18,6 +18,15 @@ logger = logging.getLogger(__name__)
|
||||
# 2. file:<class name>@<file name>
|
||||
|
||||
|
||||
class _WheelFilter(QtCore.QObject):
|
||||
def eventFilter(self, obj, event):
|
||||
if (event.type() == QtCore.QEvent.Wheel and
|
||||
event.modifiers() != QtCore.Qt.NoModifier):
|
||||
event.ignore()
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
class _ArgumentEditor(QtWidgets.QTreeWidget):
|
||||
def __init__(self, manager, dock, expurl):
|
||||
self.manager = manager
|
||||
@ -38,6 +47,8 @@ class _ArgumentEditor(QtWidgets.QTreeWidget):
|
||||
self.setHorizontalScrollMode(QtWidgets.QAbstractItemView.ScrollPerPixel)
|
||||
self.setVerticalScrollMode(QtWidgets.QAbstractItemView.ScrollPerPixel)
|
||||
|
||||
self.viewport().installEventFilter(_WheelFilter(self.viewport()))
|
||||
|
||||
self._groups = dict()
|
||||
self._arg_to_entry_widgetitem = dict()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user