PDA

View Full Version : Squeeze Slider item in QSCrollBar



paul888
21st July 2017, 08:10
Hi,

I have a custom QScrollBar that should scroll the view area only, and hence move the slider also, by pressing the arrow buttons. So, the slider should be squeezed from dragging or pressing action.

I have tried to apply triggerAction(QAbstractSlider::SliderNoAction) in the constructor of my custom QScrollBar. Unsuccess.

Please helps me out.

Ginsengelf
21st July 2017, 10:31
Hi, you could overload the mouse events and ignore the event if it occurred somewhere between the arrow buttons.

But why do you want to restrict the scrollbar that way? I personally find it a bit annoying when I know that I want to scroll to the other end, but cannot simply move the slider. I barely ever use the arrow buttons.

Ginsengelf

paul888
22nd July 2017, 17:13
Thanks.

I did your suggestion in both MousePressEvent and MouseReleaseEvent, and pushed MouseMoveEvent to do nothing.
In order to recognize the components of arrow button, the hitTestComplexControl is applied.

The scrollbar behaviour should be restricted in this way due to the design requirement.