def test_change_floatslider_range(gslider: QRangeSlider, qtbot): with qtbot.waitSignals([gslider.rangeChanged, gslider.valueChanged]): gslider.setMinimum(30) assert gslider.value()[0] == 30 == gslider.minimum() assert gslider.maximum() == 99 with qtbot.waitSignal(gslider.rangeChanged): gslider.setMaximum(70) assert gslider.value()[0] == 30 == gslider.minimum() assert gslider.value()[1] == 70 == gslider.maximum() with qtbot.waitSignals([gslider.rangeChanged, gslider.valueChanged]): gslider.setRange(40, 60) assert gslider.value()[0] == 40 == gslider.minimum() assert gslider.maximum() == 60 with qtbot.waitSignal(gslider.valueChanged): gslider.setValue([40, 50]) assert gslider.value()[0] == 40 == gslider.minimum() assert gslider.value()[1] == 50 with qtbot.waitSignals([gslider.rangeChanged, gslider.valueChanged]): gslider.setMaximum(45) assert gslider.value()[0] == 40 == gslider.minimum() assert gslider.value()[1] == 45 == gslider.maximum()
from qtrangeslider import QRangeSlider from qtrangeslider.qtcompat.QtWidgets import QApplication app = QApplication([]) slider = QRangeSlider() slider.setMinimum(0) slider.setMaximum(200) slider.setValue((0, 40, 80, 160)) slider.show() app.exec_()