diff options
author | Bill Clark <saikou@vt.edu> | 2015-04-03 14:20:15 -0400 |
---|---|---|
committer | Bill Clark <saikou@vt.edu> | 2015-04-03 14:20:15 -0400 |
commit | 7c6946e4738a4c4afd2ba49acbf865b6ee4d4f4b (patch) | |
tree | c6217c4750371ce6971b3702f0d57832810ace09 /gr-qtgui/python/qtgui/range.py | |
parent | 9f9d89c3fbae736bcc9d5bb435869cc9f3277db7 (diff) |
qtgui: range control -> jump to nearest step with left click
Diffstat (limited to 'gr-qtgui/python/qtgui/range.py')
-rwxr-xr-x | gr-qtgui/python/qtgui/range.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/gr-qtgui/python/qtgui/range.py b/gr-qtgui/python/qtgui/range.py index 9f369d687e..61eee03513 100755 --- a/gr-qtgui/python/qtgui/range.py +++ b/gr-qtgui/python/qtgui/range.py @@ -107,6 +107,19 @@ class RangeWidget(QtGui.QWidget): self.setTickPosition(2) self.valueChanged.connect(slot) + def mousePressEvent(self, event): + #opt_style = QtGui.QStyleOption.init(None) + #self.initStyleOption(opt_style) + #sr = (self.style()).subControlRect(QtGui.QStyle.CC_Slider,opt_style,QtGui.QStyle.SC_SliderHandle,parent) + if((event.button() == QtCore.Qt.LeftButton)):# and (sr.contains(event.pos()) == False)): + newVal = self.minimum() + ((self.maximum()-self.minimum()) * event.x()) / self.width() + #if self.invertedAppearance(): + # self.setValue(self.maximum() - newVal) + #else: + self.setValue(newVal) + event.accept() + QtGui.QSlider.mousePressEvent(self, event) + class Counter(QtGui.QDoubleSpinBox): """ Creates the range using a counter """ def __init__(self, parent, ranges, slot): |