mirror of https://github.com/m-labs/artiq.git
scanwidget: more adaptable sizing (8bc0c10)
This commit is contained in:
parent
11bfe33dd4
commit
a75ee76463
|
@ -32,6 +32,11 @@ class ScanWidget(QtWidgets.QSlider):
|
||||||
|
|
||||||
self.setRange(0, 4095)
|
self.setRange(0, 4095)
|
||||||
|
|
||||||
|
qfm = QtGui.QFontMetrics(self.font())
|
||||||
|
self._labelSize = QtCore.QSize(
|
||||||
|
(self.ticker.precision + 5)*qfm.averageCharWidth(),
|
||||||
|
qfm.lineSpacing())
|
||||||
|
|
||||||
self._start, self._stop, self._num = None, None, None
|
self._start, self._stop, self._num = None, None, None
|
||||||
self._axisView, self._sliderView = None, None
|
self._axisView, self._sliderView = None, None
|
||||||
self._offset, self._pressed, self._dragLeft = None, None, None
|
self._offset, self._pressed, self._dragLeft = None, None, None
|
||||||
|
@ -43,9 +48,8 @@ class ScanWidget(QtWidgets.QSlider):
|
||||||
return self.minimumSizeHint()
|
return self.minimumSizeHint()
|
||||||
|
|
||||||
def minimumSizeHint(self):
|
def minimumSizeHint(self):
|
||||||
qfm = QtGui.QFontMetrics(self.font())
|
return QtCore.QSize(2.5*3*self._labelSize.width(),
|
||||||
return QtCore.QSize(5*10*qfm.averageCharWidth(),
|
4*self._labelSize.height())
|
||||||
4*qfm.lineSpacing())
|
|
||||||
|
|
||||||
def _axisToPixel(self, val):
|
def _axisToPixel(self, val):
|
||||||
a, b = self._axisView
|
a, b = self._axisView
|
||||||
|
@ -212,7 +216,8 @@ class ScanWidget(QtWidgets.QSlider):
|
||||||
if center:
|
if center:
|
||||||
scale = min(scale, self.dynamicRange/abs(center))
|
scale = min(scale, self.dynamicRange/abs(center))
|
||||||
left = a*scale/b
|
left = a*scale/b
|
||||||
self.ticker.min_ticks = int(ev.size().width()/100)
|
self.ticker.min_ticks = int(ev.size().width() /
|
||||||
|
(2.5*self._labelSize.width()))
|
||||||
self._setView(left, scale)
|
self._setView(left, scale)
|
||||||
|
|
||||||
def paintEvent(self, ev):
|
def paintEvent(self, ev):
|
||||||
|
|
Loading…
Reference in New Issue