commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] [gnuradio] 09/13: qtgui: range control -> jump to near


From: git
Subject: [Commit-gnuradio] [gnuradio] 09/13: qtgui: range control -> jump to nearest step with left click
Date: Fri, 3 Apr 2015 19:59:35 +0000 (UTC)

This is an automated email from the git hooks/post-receive script.

jcorgan pushed a commit to branch master
in repository gnuradio.

commit 7c6946e4738a4c4afd2ba49acbf865b6ee4d4f4b
Author: Bill Clark <address@hidden>
Date:   Fri Apr 3 14:20:15 2015 -0400

    qtgui: range control -> jump to nearest step with left click
---
 gr-qtgui/python/qtgui/range.py | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/gr-qtgui/python/qtgui/range.py b/gr-qtgui/python/qtgui/range.py
index 9f369d6..61eee03 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):



reply via email to

[Prev in Thread] Current Thread [Next in Thread]