Skip to content

Commit

Permalink
+ drag and drop on tree widget
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Mar 12, 2014
1 parent 2db31c9 commit 8b901df
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 6 deletions.
27 changes: 21 additions & 6 deletions src/Gui/Tree.cpp
Expand Up @@ -307,12 +307,6 @@ void TreeWidget::onActivateDocument(QAction* active)
getMainWindow()->setActiveWindow(view);
}

bool TreeWidget::dropMimeData(QTreeWidgetItem *parent, int index,
const QMimeData *data, Qt::DropAction action)
{
return QTreeWidget::dropMimeData(parent, index, data, action);
}

Qt::DropActions TreeWidget::supportedDropActions () const
{
return QTreeWidget::supportedDropActions();
Expand Down Expand Up @@ -365,6 +359,11 @@ void TreeWidget::mouseDoubleClickEvent (QMouseEvent * event)
}
}

void TreeWidget::startDrag(Qt::DropActions supportedActions)
{
QTreeWidget::startDrag(supportedActions);
}

QMimeData * TreeWidget::mimeData (const QList<QTreeWidgetItem *> items) const
{
// all selected items must reference an object from the same document
Expand Down Expand Up @@ -394,6 +393,22 @@ QMimeData * TreeWidget::mimeData (const QList<QTreeWidgetItem *> items) const
return QTreeWidget::mimeData(items);
}

bool TreeWidget::dropMimeData(QTreeWidgetItem *parent, int index,
const QMimeData *data, Qt::DropAction action)
{
return QTreeWidget::dropMimeData(parent, index, data, action);
}

void TreeWidget::dragEnterEvent(QDragEnterEvent * event)
{
QTreeWidget::dragEnterEvent(event);
}

void TreeWidget::dragLeaveEvent(QDragLeaveEvent * event)
{
QTreeWidget::dragLeaveEvent(event);
}

void TreeWidget::dragMoveEvent(QDragMoveEvent *event)
{
QTreeWidget::dragMoveEvent(event);
Expand Down
6 changes: 6 additions & 0 deletions src/Gui/Tree.h
Expand Up @@ -78,12 +78,18 @@ class TreeWidget : public QTreeWidget, public SelectionObserver
void onSelectionChanged(const SelectionChanges& msg);
void contextMenuEvent (QContextMenuEvent * e);
void drawRow(QPainter *, const QStyleOptionViewItem &, const QModelIndex &) const;
/** @name Drag and drop */
//@{
void startDrag(Qt::DropActions supportedActions);
bool dropMimeData(QTreeWidgetItem *parent, int index, const QMimeData *data,
Qt::DropAction action);
Qt::DropActions supportedDropActions () const;
QMimeData * mimeData (const QList<QTreeWidgetItem *> items) const;
void dragEnterEvent(QDragEnterEvent * event);
void dragLeaveEvent(QDragLeaveEvent * event);
void dragMoveEvent(QDragMoveEvent *event);
void dropEvent(QDropEvent *event);
//@}
bool event(QEvent *e);
void keyPressEvent(QKeyEvent *event);
void mouseDoubleClickEvent(QMouseEvent * event);
Expand Down

0 comments on commit 8b901df

Please sign in to comment.