mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +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)
|
bool ColumnNameProvider::removeRows(int row, int count, const QModelIndex &parent)
|
||||||
{
|
{
|
||||||
|
qDebug() << "Calling";
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ColumnNameProvider::setData(const QModelIndex &index, const QVariant &value, int role)
|
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)
|
ColumnNameView::ColumnNameView(QWidget *parent)
|
||||||
{
|
{
|
||||||
|
setAcceptDrops(true);
|
||||||
|
setDragEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ColumnNameView::mousePressEvent(QMouseEvent *press)
|
void ColumnNameView::mousePressEvent(QMouseEvent *press)
|
||||||
|
@ -76,8 +77,30 @@ void ColumnNameView::mousePressEvent(QMouseEvent *press)
|
||||||
mimeData->setText(atClick.data().toString());
|
mimeData->setText(atClick.data().toString());
|
||||||
drag->setMimeData(mimeData);
|
drag->setMimeData(mimeData);
|
||||||
drag->exec();
|
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),
|
DiveLogImportDialog::DiveLogImportDialog(QStringList *fn, QWidget *parent) : QDialog(parent),
|
||||||
selector(true),
|
selector(true),
|
||||||
ui(new Ui::DiveLogImportDialog)
|
ui(new Ui::DiveLogImportDialog)
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QAbstractListModel>
|
#include <QAbstractListModel>
|
||||||
#include <QListView>
|
#include <QListView>
|
||||||
|
#include <QDragLeaveEvent>
|
||||||
|
|
||||||
#include "../dive.h"
|
#include "../dive.h"
|
||||||
#include "../divelist.h"
|
#include "../divelist.h"
|
||||||
|
@ -31,6 +32,12 @@ public:
|
||||||
ColumnNameView(QWidget *parent);
|
ColumnNameView(QWidget *parent);
|
||||||
protected:
|
protected:
|
||||||
void mousePressEvent(QMouseEvent *press);
|
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 {
|
class DiveLogImportDialog : public QDialog {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue