Important: Please read the Qt Code of Conduct -

QTableView Vertical scroll bar speed

  • Hello,

    I want to get more control on the scrollbar which is part of tableview.

    There are multiple questions -

    1. When the up arrow or down arrow key pressed, I would like to get the release event to perform some operations. How can I get it?

    2. I want to control the scrolling speed. Meaning, when I press and hold the scrollbar up or down arrow, I see that the table rows are scrolling at the defined speed. I want to control that and reduce the speed, for example, 3 rows per second. How can I do that?

    3. What does the SliderNoAction means? When does this event occurs?


  • Lifetime Qt Champion


    1. Either implement an event filter or subclass QScrollBar and reimplement keyReleaseEvent
    2. The pageStep property is a starting point but if you want rather a time based scrolling, you'll have to implement your own scroll bar.
    3. That's not an event per se. In any case, AFAIK, it's used by Qt for the repeat action.

  • @SGaist Thanks for the answers Sam!

    Answer for 1st, I have implemented and it works cool!

    1. Implementing my own scroll bar, hmm, I dont want to go through the whole pain that Qt took for implementing this. I wish Qt provides interface to manage this. But, when I took a quick look at the source code, it looks like, there is no speed management implemented.

    2. Thanks for the information. But, if this is internal to Qt, why should they show it for end user, it confuses a bit. At a moment, I thought that, when slider is operated and user has now stopped operating, NoAction would be generated. But that is not correct as you mentioned.

  • Lifetime Qt Champion

    1. AFAIK, there's not indeed
    2. It's not internal, what I was showing is the use of that enum value in Qt's own code.

  • Thanks for the answers Sam!

Log in to reply