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

Is it possible to automatically apply kinetic scrolling to every scrolling widget in an app?



  • I know QScroller is the class I need to use to enable kinetic scrolling for my scrolling widgets. I also know that the following line of code is what I need to add kinetic scrolling to the object scrollArea.

    QScroller::grabGesture(scrollArea, QScroller::LeftMouseButtonGesture);
    

    My question is:

    Is there a way of adding kinetic scrolling to every scrolling widget in my app without repeating the line above for every widget?

    I'm not saying would be hard to do that. What may be hard is detecting which widgets will grow to the point of needing scrolling. So, if exists a more scalable solution, I'd like to know.


  • Lifetime Qt Champion

    Hi,

    You can use QObject::findChildren to get all QScrollAreas of your application and apply that line on them.


Log in to reply