Added drag and drop support.

Implemented our own insertRows/deleteRows to avoid bug caused by default drag and drop behaviour of Qt

https://bugreports.qt-project.org/browse/QTBUG-26229
https://bugreports.qt-project.org/browse/QTBUG-6679
p4#: 21028
This commit is contained in:
Magne Sjaastad
2013-03-21 13:41:44 +01:00
parent 1e8d5236d1
commit b0503cabba
5 changed files with 122 additions and 23 deletions

View File

@@ -96,8 +96,9 @@ class RimUiTreeModelPdm : public caf::UiTreeModelPdm
public:
RimUiTreeModelPdm(QObject* parent);
// Overrides
virtual bool insertRows(int position, int rows, const QModelIndex &parent = QModelIndex());
// TO BE DELETED, NOT USED
virtual bool insertRows_special(int position, int rows, const QModelIndex &parent = QModelIndex());
// Special edit methods
bool deleteRangeFilter(const QModelIndex& itemIndex);
@@ -119,6 +120,12 @@ public:
void updateScriptPaths();
virtual Qt::DropActions supportedDropActions() const;
virtual Qt::ItemFlags flags(const QModelIndex &index) const;
virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent);
virtual QMimeData * mimeData(const QModelIndexList &indexes) const;
virtual QStringList mimeTypes() const;
private slots:
void slotRefreshScriptTree(QString path);
void clearClipboard();