0

Is there a signal that I can emit if the arrow button of the QScrollBar is pressed? As far as I know there is only the sliderPressed() signal. I want, if it exists, another solution from valueChanged() signal.

cmannett85
  • 21,725
  • 8
  • 76
  • 119
salvador
  • 1,079
  • 3
  • 14
  • 28
  • You want to emit or **connect to**? Because if you are emitting, means your coding your widget ie, you can creat your own signal... – trompa May 09 '13 at 12:11
  • For what reason good sir?, I can't think of a reason you would need to know if a specific arrow is pressed on a slider. –  May 09 '13 at 14:02
  • I have implemented a grid that fetches the data from a database. When i press the arrow key i want to get the new data silmuntaneously. But when i scoll or move the slider i don't want the to get the new data until the slider is stopped. So i can't use the valueChanged() singal because this affect also the movement of the slider. – salvador May 10 '13 at 10:34

2 Answers2

1

I had the same problem and solved it connecting the same callback function to sliderReleased() and valueChanged() and checking in the function if the slider is "down" (meaning pushed) with isSliderDown():

    slider = QtGui.QScrollBar()
    slider.valueChanged.connect(slider_callback)
    slider.sliderReleased.connect(slider_callback)

    def slider_callback():
       if slider.isSliderDown():
          pass
       else:
          print("now i am updating")
koxx
  • 317
  • 4
  • 15
0

All signals QScrollBar emits (inherited from QAbstractSlider) related o slider/value changed:

void    actionTriggered ( int action )
void    rangeChanged ( int min, int max )
void    sliderMoved ( int value )
void    sliderPressed ()
void    sliderReleased ()
void    valueChanged ( int value )
trompa
  • 1,967
  • 1
  • 18
  • 26