How to drap item from QTableView to QPushButton?

60 views Asked by At

I have a QTableView with some rows,and set it tableView.setDragDropMode(QAbstractItemView::DragOnly);

and then I set deleteButton.setAcceptDrops(true); It seems that I can not drop and release an item from tableView to button. What is the problem? How can I solve?

1

There are 1 answers

0
albert135 On

I have solved the problem. I have iinherited the QPushButton class and implement

void dragEnterEvent(QDragEnterEvent *event); void dropEvent(QDropEvent *event);