Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Kinetic scrolling via mouse wheel



  • Hey all,

    I have a subclassed QTableWidget with some rows and I would like to scroll though it smoothly. I have tried using QScroller which seems to be class of choice for this kind of problem but I wasn't able to achieve what I wanted.

    I was only able to get kinetic scrolling when clicking at a row and then moving the mouse up (like touching a list of the smartphone). What I would like to achieve is pretty much the same but with scrolling the mouse wheel instead.

    Is there a way to do this with the predefined class or do I need to implement this myself?



  • @jsmolka
    You don't say whether you are using desktop or mobile (assume desktop because of mousewheel?).

    Articles like:
    https://falsinsoft.blogspot.co.uk/2015/09/qt-snippet-use-qscroller-with.html
    http://www.qtcentre.org/threads/55778-Scrolling-using-QScroller-class
    seem to suggest it should work with desktop mouse, or give hints for code.

    Just checking you've read them.



  • @JonB

    Yes. I am on PC and those articles don't really help. I want to scroll the mouse wheel and have a QScroller like effect. From what I've read QScroller only supports the left and right mouse button because it wants them to be pressed. I wasn't able to find something about the mouse wheel anywhere online.



  • @jsmolka
    This is way beyond my pay-grade, but at the end of the day if it's really the case that QScroller doesn't do what you want with mousewheel, can you not intercept those events and do your own QScrollBar::setValue() directly if there's no other way? I leave this possibitily with you.


Log in to reply