mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 14:25:27 +00:00
More DragDrop skeletons
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
0a1908137b
commit
81f2ee5892
2 changed files with 32 additions and 2 deletions
|
@ -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)
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Add table
Reference in a new issue