forked from M-Labs/artiq
scanwidget: scroll and code simplification (0cca4a3)
This commit is contained in:
parent
ec5c2b6699
commit
a4e916de73
|
@ -155,9 +155,7 @@ class _RangeScan(LayoutWidget):
|
|||
spinbox.setSuffix(" " + procdesc["unit"])
|
||||
|
||||
self.scanner = scanner = ScanWidget()
|
||||
scanner.setFocusPolicy(QtCore.Qt.StrongFocus)
|
||||
scanner.setSizePolicy(QtWidgets.QSizePolicy(
|
||||
QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed))
|
||||
disable_scroll_wheel(scanner)
|
||||
self.addWidget(scanner, 0, 0, -1, 1)
|
||||
|
||||
self.min = ScientificSpinBox()
|
||||
|
|
|
@ -156,14 +156,12 @@ class ScanWidget(QtWidgets.QWidget):
|
|||
|
||||
def wheelEvent(self, ev):
|
||||
y = ev.angleDelta().y()/120.
|
||||
if not y:
|
||||
return
|
||||
if ev.modifiers() & QtCore.Qt.ShiftModifier:
|
||||
if y:
|
||||
self.setNum(max(1, self._num + y))
|
||||
elif ev.modifiers() & QtCore.Qt.ControlModifier:
|
||||
if y:
|
||||
self._zoom(self.zoomFactor**y, ev.x())
|
||||
self.setNum(max(1, self._num + y))
|
||||
else:
|
||||
ev.ignore()
|
||||
self._zoom(self.zoomFactor**y, ev.x())
|
||||
|
||||
def resizeEvent(self, ev):
|
||||
if not ev.oldSize().isValid():
|
||||
|
|
Loading…
Reference in New Issue