diff --git a/eqt/ui/UISliderLEditWidget.py b/eqt/ui/UISliderLEditWidget.py index 1f22f86..81778a0 100644 --- a/eqt/ui/UISliderLEditWidget.py +++ b/eqt/ui/UISliderLEditWidget.py @@ -20,6 +20,7 @@ def __init__(self, minimum=0.0, maximum=1.0, step_size=1.0, scale_factor=1.0): self.maximum = maximum self.scale_factor = scale_factor self.step_size = step_size + self.tick_interval = self.step_size * self.scale_factor # Configure the QSlider self.slider = QSlider() @@ -72,16 +73,16 @@ def get_slider_value(self): return self.slider.value() def get_line_edit_value(self): - return float(self.line_edit.text()) + return self.line_edit.text() def update_slider(self): state = self.validator.validate(self.line_edit.text(), 0) if state[0] == QtGui.QDoubleValidator.Acceptable: - line_edit_value = self.get_line_edit_value() + line_edit_value = float(self.get_line_edit_value()) self.slider.setValue(line_edit_value) else: self.line_edit.setText(str(self.minimum)) - line_edit_value = self.get_line_edit_value() + line_edit_value = float(self.get_line_edit_value()) self.slider.setValue(line_edit_value) def update_line_edit(self): diff --git a/examples/dialog_example_uislider.py b/examples/dialog_example_uislider.py index 4e4921b..1fd8f6a 100644 --- a/examples/dialog_example_uislider.py +++ b/examples/dialog_example_uislider.py @@ -31,7 +31,7 @@ def openFormDialog(self): line_edit = QtWidgets.QLineEdit() max_label = QtWidgets.QLabel() uislider = UISliderWidget.UISliderWidget(line_edit, max_label, minimum=0.0, maximum=100.0, - step_size=1.0) + scale_factor=10.0) # add to the form widget dialog.addWidget(uislider, 'QSlider 1:', 'input_slider1')