mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
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>
This commit is contained in:
parent
59fc5cecb7
commit
1ba08e2fec
2 changed files with 35 additions and 0 deletions
|
@ -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);
|
||||
|
|
|
@ -50,6 +50,10 @@ 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;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue