From 57cd8170e2f7554a81b9a022ab9815d60c897421 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20=C3=81ngel=20San=20Mart=C3=ADn?= Date: Sun, 30 Nov 2014 22:57:25 +0100 Subject: [PATCH] fixed performDrag in YACReaderTableView for delegating the setup of the mimedata to the model --- custom_widgets/yacreader_table_view.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/custom_widgets/yacreader_table_view.cpp b/custom_widgets/yacreader_table_view.cpp index 85a092af..34654ced 100644 --- a/custom_widgets/yacreader_table_view.cpp +++ b/custom_widgets/yacreader_table_view.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include "comic_item.h" @@ -148,12 +149,8 @@ void YACReaderTableView::leaveEvent(QEvent * event) void YACReaderTableView::performDrag() { - QMimeData *mimeData = new QMimeData; - - mimeData->setText("comic"); //TODO set the right mime data - QDrag *drag = new QDrag(this); - drag->setMimeData(mimeData); + drag->setMimeData(model()->mimeData(selectionModel()->selectedRows())); drag->setPixmap(QPixmap(":/images/openInYACReader.png")); //TODO add better image Qt::DropAction dropAction = drag->exec(Qt::CopyAction | Qt::MoveAction, Qt::CopyAction);