Dropped contents is not getting placed into cells in qtablewidget
-
hello ,
i'm not getting how to place dropped contents in cells of tablewidget , here is my code . i'm getting dragged contents but the problem is in placing into cells :( please do help me to solve this problem.@void ProjectListWidget::dropEvent(QDropEvent *event)
{
qDebug()<<"drop event";
ProjectListWidget *source =
qobject_cast<ProjectListWidget *>(event->source());
if (source && source != this) {
QString str=event->mimeData()->text();
qDebug()<<"str=="<<str;
event->setDropAction(Qt::CopyAction);
event->accept();
}
}@ -
Hi,
Basically you are not doing anything with the mime data so it won't appear in your list widget.
Have a look at "this":http://qt-project.org/doc/qt-5.0/qtwidgets/model-view-programming.html#using-drag-and-drop-with-item-views for an explanation about the drag and drop and item views.
Hope it helps