Autoscroll QTreeview only vertically

  • I want to autoscroll while making Drag and drop operations, I know that it can be set by: setAutoScroll(true)

    but it activates autoscrolls in vertical and horizontal direction. Is it a way to activate only the vertical autoscrolling?

    Thank you,

  • Moderators

    no there is no such property to limit the directions.

    But you could do the following:

    • disable Qt autoscroll feature
    • install an eventfilter on the viewport
    • on dragmove check if the pos is in a top/bottom margin (defined by you)
    • if yes start a timer which periodically in-/decreases the value of the vertical scrollbar (if visible)
    • stop the timer on drop drag-leave events

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.