From 909be75113ef395e0a73eb8dd8698b101fd17cb2 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Tue, 6 Jan 2015 17:19:08 -0200 Subject: [PATCH] Re-add the string to the avaliable models if drag cancelled Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- qt-ui/divelogimportdialog.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/qt-ui/divelogimportdialog.cpp b/qt-ui/divelogimportdialog.cpp index 245c240c3..539238560 100644 --- a/qt-ui/divelogimportdialog.cpp +++ b/qt-ui/divelogimportdialog.cpp @@ -92,8 +92,11 @@ void ColumnNameView::mousePressEvent(QMouseEvent *press) model()->removeRow(atClick.row()); drag->setPixmap(pix); drag->setMimeData(mimeData); - drag->exec(); - + if (drag->exec() == Qt::IgnoreAction){ + model()->insertRow(model()->rowCount()); + QModelIndex idx = model()->index(model()->rowCount()-1, 0); + model()->setData(idx, mimeData->text()); + } } void ColumnNameView::dragLeaveEvent(QDragLeaveEvent *leave)