forked from M-Labs/artiq
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>
|
# 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):
|
class _ArgumentEditor(QtWidgets.QTreeWidget):
|
||||||
def __init__(self, manager, dock, expurl):
|
def __init__(self, manager, dock, expurl):
|
||||||
self.manager = manager
|
self.manager = manager
|
||||||
|
@ -38,6 +47,8 @@ class _ArgumentEditor(QtWidgets.QTreeWidget):
|
||||||
self.setHorizontalScrollMode(QtWidgets.QAbstractItemView.ScrollPerPixel)
|
self.setHorizontalScrollMode(QtWidgets.QAbstractItemView.ScrollPerPixel)
|
||||||
self.setVerticalScrollMode(QtWidgets.QAbstractItemView.ScrollPerPixel)
|
self.setVerticalScrollMode(QtWidgets.QAbstractItemView.ScrollPerPixel)
|
||||||
|
|
||||||
|
self.viewport().installEventFilter(_WheelFilter(self.viewport()))
|
||||||
|
|
||||||
self._groups = dict()
|
self._groups = dict()
|
||||||
self._arg_to_entry_widgetitem = dict()
|
self._arg_to_entry_widgetitem = dict()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue