Changeset 4992ff2 in sasview for src/sas/qtgui/Plotting/rangeSlider.py
- Timestamp:
- Nov 9, 2017 8:43:07 AM (7 years ago)
- Branches:
- ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
- Children:
- 7969b9c
- Parents:
- 7fb471d
- git-author:
- Piotr Rozyczko <rozyczko@…> (10/30/17 07:50:09)
- git-committer:
- Piotr Rozyczko <rozyczko@…> (11/09/17 08:43:07)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Plotting/rangeSlider.py
- Property mode changed from 100755 to 100644
r83eb5208 r4992ff2 23 23 """ 24 24 25 from PyQt4 import QtGui, QtCore 26 27 class RangeSlider(QtGui.QSlider): 25 from PyQt5 import QtCore 26 from PyQt5 import QtGui 27 from PyQt5 import QtWidgets 28 29 class RangeSlider(QtWidgets.QSlider): 28 30 """ A slider for ranges. 29 31 … … 46 48 self._high = self.maximum() 47 49 48 self.pressed_control = Qt Gui.QStyle.SC_None49 self.hover_control = Qt Gui.QStyle.SC_None50 self.pressed_control = QtWidgets.QStyle.SC_None 51 self.hover_control = QtWidgets.QStyle.SC_None 50 52 self.click_offset = 0 51 53 … … 90 92 91 93 for i, value in enumerate([self._low, self._high]): 92 opt = Qt Gui.QStyleOptionSlider()94 opt = QtWidgets.QStyleOptionSlider() 93 95 self.initStyleOption(opt) 94 96 … … 107 109 slider_max = gr.bottom() - handle_length + 1 108 110 109 opt.subControls = Qt Gui.QStyle.SC_SliderGroove | QtGui.QStyle.SC_SliderHandle111 opt.subControls = QtWidgets.QStyle.SC_SliderGroove | QtWidgets.QStyle.SC_SliderHandle 110 112 111 113 # draw the first slider with inverted appearance, then the second … … 131 133 # do not highlight the second part when has focus to avoid 132 134 # drawing of partially overlapped semi-transparent backgrounds 133 opt.state &= ~Qt Gui.QStyle.State_HasFocus135 opt.state &= ~QtWidgets.QStyle.State_HasFocus 134 136 135 137 opt.sliderValue = 0 … … 157 159 158 160 if self.tickPosition() != self.NoTicks: 159 opt.subControls |= Qt Gui.QStyle.SC_SliderTickmarks161 opt.subControls |= QtWidgets.QStyle.SC_SliderTickmarks 160 162 161 163 if self.pressed_control: 162 164 opt.activeSubControls = self.pressed_control 163 opt.state |= Qt Gui.QStyle.State_Sunken165 opt.state |= QtWidgets.QStyle.State_Sunken 164 166 else: 165 167 opt.activeSubControls = self.hover_control 166 168 167 style.drawComplexControl(Qt Gui.QStyle.CC_Slider, opt, painter, self)169 style.drawComplexControl(QtWidgets.QStyle.CC_Slider, opt, painter, self) 168 170 169 171 … … 181 183 182 184 if button: 183 opt = Qt Gui.QStyleOptionSlider()185 opt = QtWidgets.QStyleOptionSlider() 184 186 self.initStyleOption(opt) 185 187 … … 206 208 207 209 if self.active_slider == 0: 208 self.pressed_control = Qt Gui.QStyle.SC_SliderHandle210 self.pressed_control = QtWidgets.QStyle.SC_SliderHandle 209 211 self.click_offset = self.__pixelPosToRangeValue(self.__pick(event.pos())) 210 212 self.triggerAction(self.SliderMove) … … 215 217 216 218 def mouseReleaseEvent(self, event): 217 if self.pressed_control != Qt Gui.QStyle.SC_SliderHandle:219 if self.pressed_control != QtWidgets.QStyle.SC_SliderHandle: 218 220 event.ignore() 219 221 return 220 222 221 223 self.setSliderDown(False) 222 return Qt Gui.QSlider.mouseReleaseEvent(self, event)224 return QtWidgets.QSlider.mouseReleaseEvent(self, event) 223 225 224 226 def mouseMoveEvent(self, event): 225 if self.pressed_control != Qt Gui.QStyle.SC_SliderHandle:227 if self.pressed_control != QtWidgets.QStyle.SC_SliderHandle: 226 228 event.ignore() 227 229 return … … 229 231 event.accept() 230 232 new_pos = self.__pixelPosToRangeValue(self.__pick(event.pos())) 231 opt = Qt Gui.QStyleOptionSlider()233 opt = QtWidgets.QStyleOptionSlider() 232 234 self.initStyleOption(opt) 233 235 … … 274 276 275 277 def __pixelPosToRangeValue(self, pos): 276 opt = Qt Gui.QStyleOptionSlider()278 opt = QtWidgets.QStyleOptionSlider() 277 279 self.initStyleOption(opt) 278 280 style = QtGui.QApplication.style()
Note: See TracChangeset
for help on using the changeset viewer.