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

Drag and drop case (Tree to Table)



  • Hello everyone,

    I am trying to do following, on my left side there is a treewidget and on my right there is a tableview with custom model. I would like to take item from treewidget (grab) and move onto tableview and item should be added on the end of the list.
    I am not interested in data located in treewidget (captions) but ID that is connected to the item itself.
    I had idea to go around and do the following:

    1. Detect when item is selected in treewidget and then mouse clicked is pressed.
    2. Detect if mouse is released on tableview (and if item was selected) do the action of adding new data to the table

    Issue is that there is no mouseRelease signal for tableview and to be honest this doesn't seem the right way to do it.
    Could someone please explain the right steps to achieve this.

    Thank you for helping out a newb!


  • Moderators

    @vnv
    you should read this and this.
    You can easily add custom data (e.g. your desired ID) to the drag and check it in the target drop


Log in to reply