diff options
author | Tomaz Canabrava <tomaz.canabrava@intel.com> | 2015-01-06 15:14:14 -0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-01-06 19:37:20 -0800 |
commit | 81f2ee589246556271aae73f2dcbaba019b18207 (patch) | |
tree | 640527b6f3f1c822308df16ea3ff36a50a99a451 /qt-ui | |
parent | 0a1908137b587379d26c1891bb897347169c9235 (diff) | |
download | subsurface-81f2ee589246556271aae73f2dcbaba019b18207.tar.gz |
More DragDrop skeletons
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r-- | qt-ui/divelogimportdialog.cpp | 27 | ||||
-rw-r--r-- | qt-ui/divelogimportdialog.h | 7 |
2 files changed, 32 insertions, 2 deletions
diff --git a/qt-ui/divelogimportdialog.cpp b/qt-ui/divelogimportdialog.cpp index dbb3f60dd..9db910661 100644 --- a/qt-ui/divelogimportdialog.cpp +++ b/qt-ui/divelogimportdialog.cpp @@ -34,7 +34,7 @@ bool ColumnNameProvider::insertRows(int row, int count, const QModelIndex &paren bool ColumnNameProvider::removeRows(int row, int count, const QModelIndex &parent) { - + qDebug() << "Calling"; } bool ColumnNameProvider::setData(const QModelIndex &index, const QVariant &value, int role) @@ -61,7 +61,8 @@ int ColumnNameProvider::rowCount(const QModelIndex &parent) const ColumnNameView::ColumnNameView(QWidget *parent) { - + setAcceptDrops(true); + setDragEnabled(true); } void ColumnNameView::mousePressEvent(QMouseEvent *press) @@ -76,8 +77,30 @@ void ColumnNameView::mousePressEvent(QMouseEvent *press) mimeData->setText(atClick.data().toString()); drag->setMimeData(mimeData); drag->exec(); + currentDraggedIndex = atClick.row(); +} + +void ColumnNameView::dragLeaveEvent(QDragLeaveEvent *leave) +{ + model()->removeRow(currentDraggedIndex); +} + +void ColumnNameView::dragEnterEvent(QDragEnterEvent *event) +{ + } +void ColumnNameView::dragMoveEvent(QDragMoveEvent *event) +{ + +} + +void ColumnNameView::dropEvent(QDropEvent *event) +{ + +} + + 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 9441fa71a..efb7f296a 100644 --- a/qt-ui/divelogimportdialog.h +++ b/qt-ui/divelogimportdialog.h @@ -4,6 +4,7 @@ #include <QDialog> #include <QAbstractListModel> #include <QListView> +#include <QDragLeaveEvent> #include "../dive.h" #include "../divelist.h" @@ -31,6 +32,12 @@ public: ColumnNameView(QWidget *parent); protected: void mousePressEvent(QMouseEvent *press); + void dragLeaveEvent(QDragLeaveEvent *leave); + void dragEnterEvent(QDragEnterEvent *event); + void dragMoveEvent(QDragMoveEvent *event); + void dropEvent(QDropEvent *event); +private: + int currentDraggedIndex; }; class DiveLogImportDialog : public QDialog { |