summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2015-01-06 15:03:58 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-01-06 19:35:12 -0800
commit0a1908137b587379d26c1891bb897347169c9235 (patch)
treed0ac7193cc1089b7101bc2d283cfe7024ea43cba
parent2034508c074c55774a489cb86076365d2acee050 (diff)
downloadsubsurface-0a1908137b587379d26c1891bb897347169c9235.tar.gz
Start to drag the correct values
This piece of code starts a drag and moves around data, it does nothing with it yet. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--qt-ui/divelogimportdialog.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/qt-ui/divelogimportdialog.cpp b/qt-ui/divelogimportdialog.cpp
index d3a29ba0d..dbb3f60dd 100644
--- a/qt-ui/divelogimportdialog.cpp
+++ b/qt-ui/divelogimportdialog.cpp
@@ -6,7 +6,9 @@
#include "ui_divelogimportdialog.h"
#include <QAbstractListModel>
#include <QAbstractTableModel>
-
+#include <QMouseEvent>
+#include <QDrag>
+#include <QMimeData>
const DiveLogImportDialog::CSVAppConfig DiveLogImportDialog::CSVApps[CSVAPPS] = {
// time, depth, temperature, po2, cns, ndl, tts, stopdepth, pressure
{ "", },
@@ -64,7 +66,16 @@ ColumnNameView::ColumnNameView(QWidget *parent)
void ColumnNameView::mousePressEvent(QMouseEvent *press)
{
+ QModelIndex atClick = indexAt(press->pos());
+ if (!atClick.isValid())
+ return;
+ qDebug() << atClick.data();
+ QDrag *drag = new QDrag(this);
+ QMimeData *mimeData = new QMimeData;
+ mimeData->setText(atClick.data().toString());
+ drag->setMimeData(mimeData);
+ drag->exec();
}
DiveLogImportDialog::DiveLogImportDialog(QStringList *fn, QWidget *parent) : QDialog(parent),