Infinity
31st March 2013, 21:16
Hi
I have a QTableWidget and I want to enable Drag & Drop functionality. For that I'm using the following code:
tableWidget->setDragEnabled(true);
tableWidget->setDragDropOverwriteMode(true);
tableWidget->setDragDropMode(QAbstractItemView::DragDrop);
tableWidget->setDefaultDropAction(Qt::CopyAction);
The Drag & Drop functionality works, but only between other QTableWidgets. It doesn't work between a QTableWidget and a QLineEdit. Is it possible to enable Drag & Drop between QTableWidgets and QLineEdits, too?
Has someone an idea to solve the problem?
EDIT: I already tried overwriting dropEvent, dragMoveEvent and dragEnterEvent. I'm not sure what to do, but simply calling event->acceptProposedAction(); or calling event->accept(); doesn't work.
If I use the following code and try do drop some text from any text field (e. g. the address bar in my browser) my application terminates (segmentation fault).
void DragAndDropTableWidget::dragEnterEvent(QDragEnterE vent *event)
{
event->acceptProposedAction();
}
(I'm using the Linux Version of Qt 5.0.1)
I have a QTableWidget and I want to enable Drag & Drop functionality. For that I'm using the following code:
tableWidget->setDragEnabled(true);
tableWidget->setDragDropOverwriteMode(true);
tableWidget->setDragDropMode(QAbstractItemView::DragDrop);
tableWidget->setDefaultDropAction(Qt::CopyAction);
The Drag & Drop functionality works, but only between other QTableWidgets. It doesn't work between a QTableWidget and a QLineEdit. Is it possible to enable Drag & Drop between QTableWidgets and QLineEdits, too?
Has someone an idea to solve the problem?
EDIT: I already tried overwriting dropEvent, dragMoveEvent and dragEnterEvent. I'm not sure what to do, but simply calling event->acceptProposedAction(); or calling event->accept(); doesn't work.
If I use the following code and try do drop some text from any text field (e. g. the address bar in my browser) my application terminates (segmentation fault).
void DragAndDropTableWidget::dragEnterEvent(QDragEnterE vent *event)
{
event->acceptProposedAction();
}
(I'm using the Linux Version of Qt 5.0.1)