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

Draggable Listview



  • Hello everyone!

    Maybe it will be a stupid question, but how to restrict draggable ListView behaviour? Maybe it was stated somewhere, but I cannot find good practice approach. I want to make ListView scrollable only by mouse wheel or ScrollBar without draggable behaviour.



  • Look at the docs. ListView is based upon Flickable.



  • @fcarney I know about interactive, but it disables scrolling by mouse and by scrollbar. Should Scrollbar be added manually within this approach?



  • @St-Stanislav said in Draggable Listview:

    Should Scrollbar be added manually within this approach?

    I have listviews that I turn interactive off with. I then add ScrollBar.vertical: ScrollBar{/* settings */}



  • @fcarney Sorry for the long reply. With this approach ScrollBar can be used for the scrolling well enough. But mouse wheel is inactive. Should the MouseArea be added manually?

    Honestly, I ask about this straightforward (and evident) things, because cannot belive that simple disabling draggable behaviour is accompanied by so many additional things.



  • @St-Stanislav said in Draggable Listview:

    But mouse wheel is inactive.

    I just checked my listviews and mouse wheel doesn't seem to work. I honestly don't know if they worked before or not. Do they work with Interactive set to true?

    The problem with QML is the newer objects are designed around tablet/phone paradigm. So it is not always good fit for desktop. Or it takes extra work. Please let us know what you find out implementing mouse scroll wheel in a list with interactive off.


Log in to reply