2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-25 11:18:27 +08:00

scanwidget: scroll and code simplification (0cca4a3)

This commit is contained in:
Robert Jördens 2016-03-16 23:47:28 +01:00
parent ec5c2b6699
commit a4e916de73
2 changed files with 5 additions and 9 deletions

View File

@ -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()

View File

@ -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():