Drag drop signal for two QListViewWidgets



  • Hi, i have two QlistViewWidgets by setting :
    @
    list1->setDragDropMode(QAbstractItemView::DragDrop);
    list1->setDefaultDropAction(Qt::MoveAction);
    list2->setDragDropMode(QAbstractItemView::DragDrop);
    list2->setDefaultDropAction(Qt::MoveAction);
    @
    i am able to drag and drop items between both list views what i need now is a signal and slot to show when the items have been dragged and drop - preferably with their index / text.

    is there any way to do this ?

    Cheers, Tim.


  • Lifetime Qt Champion

    Hi,

    I would subclass and reimplement the startDrag and dropEvent functions for example

    Hope it helps



  • Cheers for the direction SGalst.
    i manged to get hold of the dropEvent and dragMoveEvent using this code:
    @
    listWidget::listWidget(QWidget *parent)
    : QListWidget(parent)
    {
    setDragDropMode(QAbstractItemView::DragDrop);
    setDefaultDropAction(Qt::MoveAction);
    }

    void listWidget::dropEvent(QDropEvent *event)
    {
    QListWidget::dropEvent(event);
    }

    void listWidget::dragMoveEvent(QDragMoveEvent *e)
    {

    QListWidget::dragMoveEvent(e);
    

    }

    @

    but im kind of clueless of what to do from here. i need to be able to get the statustip of the item moved.

    any way to do this?


  • Lifetime Qt Champion

    What do you mean by statustip ?



  • basically my list widget items status tip is the actual physical location of the file which it represents. When the user moves the list item between the two listviewwidgets i would like to actually move the file too.



  • ill take a print screen which will hopefully make more sense


  • Lifetime Qt Champion

    If you are using a QFileSystemModel underneath and IIRC you should just have to make it writable and all this should be handled for you.


Log in to reply
 

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