diff options
-rw-r--r-- | qt-ui/divelogimportdialog.cpp | 21 | ||||
-rw-r--r-- | qt-ui/divelogimportdialog.h | 1 |
2 files changed, 22 insertions, 0 deletions
diff --git a/qt-ui/divelogimportdialog.cpp b/qt-ui/divelogimportdialog.cpp index d5fcd40a9..963c75710 100644 --- a/qt-ui/divelogimportdialog.cpp +++ b/qt-ui/divelogimportdialog.cpp @@ -211,6 +211,27 @@ void ColumnNameResult::setColumnValues(QList<QStringList> columns) endInsertRows(); } +void ColumnDropCSVView::mousePressEvent(QMouseEvent *press) +{ + QModelIndex atClick = indexAt(press->pos()); + if (!atClick.isValid() || atClick.row()) + return; + + QRect indexRect = visualRect(atClick); + QPixmap pix(indexRect.width(), indexRect.height()); + pix.fill(QColor(0,0,0,0)); + render(&pix, QPoint(0, 0),QRegion(indexRect)); + + QDrag *drag = new QDrag(this); + QMimeData *mimeData = new QMimeData; + mimeData->setData(subsurface_mimedata, atClick.data().toByteArray()); + drag->setPixmap(pix); + drag->setMimeData(mimeData); + if (drag->exec() != Qt::IgnoreAction){ + // Do stuff here. + } +} + DiveLogImportDialog::DiveLogImportDialog(QStringList fn, QWidget *parent) : QDialog(parent), selector(true), ui(new Ui::DiveLogImportDialog) diff --git a/qt-ui/divelogimportdialog.h b/qt-ui/divelogimportdialog.h index 8dc260a7d..0043f3ff2 100644 --- a/qt-ui/divelogimportdialog.h +++ b/qt-ui/divelogimportdialog.h @@ -58,6 +58,7 @@ class ColumnDropCSVView : public QTableView { public: ColumnDropCSVView(QWidget *parent); protected: + void mousePressEvent(QMouseEvent *press); void dragLeaveEvent(QDragLeaveEvent *leave); void dragEnterEvent(QDragEnterEvent *event); void dragMoveEvent(QDragMoveEvent *event); |