diff options
author | Tomaz Canabrava <tomaz.canabrava@intel.com> | 2015-01-06 22:24:46 -0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-01-06 19:38:40 -0800 |
commit | 1ba08e2fec619b105cb0d3d0718758bdcc9c7d87 (patch) | |
tree | d86f87d7b585de39b76101c2fbce6ecc064ddaac /qt-ui/divelogimportdialog.cpp | |
parent | 59fc5cecb71ebf2edcca2cc7818b92bc621c2620 (diff) | |
download | subsurface-1ba08e2fec619b105cb0d3d0718758bdcc9c7d87.tar.gz |
Make it possible to move from top to bottom
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/divelogimportdialog.cpp')
-rw-r--r-- | qt-ui/divelogimportdialog.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/qt-ui/divelogimportdialog.cpp b/qt-ui/divelogimportdialog.cpp index 632659cd2..7d165b892 100644 --- a/qt-ui/divelogimportdialog.cpp +++ b/qt-ui/divelogimportdialog.cpp @@ -103,6 +103,37 @@ void ColumnNameView::mousePressEvent(QMouseEvent *press) } } +void ColumnNameView::dragLeaveEvent(QDragLeaveEvent *leave) +{ + Q_UNUSED(leave); +} + +void ColumnNameView::dragEnterEvent(QDragEnterEvent *event) +{ + event->acceptProposedAction(); +} + +void ColumnNameView::dragMoveEvent(QDragMoveEvent *event) +{ + QModelIndex curr = indexAt(event->pos()); + if (!curr.isValid() || curr.row() != 0) + return; + event->acceptProposedAction(); +} + +void ColumnNameView::dropEvent(QDropEvent *event) +{ + const QMimeData *mimeData = event->mimeData(); + if (mimeData->data(subsurface_mimedata).count()) { + if (event->source() != this) { + event->acceptProposedAction(); + QVariant value = QString(mimeData->data(subsurface_mimedata)); + model()->insertRow(model()->rowCount()); + model()->setData(model()->index(model()->rowCount()-1, 0), value); + } + } +} + ColumnDropCSVView::ColumnDropCSVView(QWidget *parent) { setAcceptDrops(true); |