diff options
| -rw-r--r-- | src/modlistsortproxy.cpp | 20 | ||||
| -rw-r--r-- | src/modlistsortproxy.h | 6 | ||||
| -rw-r--r-- | src/modlistview.cpp | 2 |
3 files changed, 25 insertions, 3 deletions
diff --git a/src/modlistsortproxy.cpp b/src/modlistsortproxy.cpp index e86c6f34..cf82ca74 100644 --- a/src/modlistsortproxy.cpp +++ b/src/modlistsortproxy.cpp @@ -618,6 +618,26 @@ bool ModListSortProxy::filterAcceptsRow(int row, const QModelIndex &parent) cons }
}
+bool ModListSortProxy::canDropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent) const
+{
+ if (!data->hasUrls() && sortColumn() != ModList::COL_PRIORITY) {
+ return false;
+ }
+
+ // disable drop install with group proxy, except the one for collapsible separator
+ // - it would be nice to be able to "install to category" or something like that but
+ // it's a bit more complicated since the drop position is based on the category, so
+ // just disabling for now
+ if (data->hasText() && data->text() == "archive") {
+ // maybe there is a cleaner way?
+ if (qobject_cast<QtGroupingProxy*>(sourceModel())) {
+ return false;
+ }
+ }
+
+ return QSortFilterProxyModel::canDropMimeData(data, action, row, column, parent);
+}
+
bool ModListSortProxy::dropMimeData(const QMimeData *data, Qt::DropAction action,
int row, int column, const QModelIndex &parent)
{
diff --git a/src/modlistsortproxy.h b/src/modlistsortproxy.h index 90b6251e..811aec66 100644 --- a/src/modlistsortproxy.h +++ b/src/modlistsortproxy.h @@ -78,9 +78,9 @@ public: void setProfile(Profile *profile);
- virtual Qt::ItemFlags flags(const QModelIndex &modelIndex) const;
- virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action,
- int row, int column, const QModelIndex &parent);
+ Qt::ItemFlags flags(const QModelIndex &modelIndex) const override;
+ bool canDropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent) const override;
+ bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override;
virtual void setSourceModel(QAbstractItemModel *sourceModel) override;
diff --git a/src/modlistview.cpp b/src/modlistview.cpp index 91bdced3..65e35a8b 100644 --- a/src/modlistview.cpp +++ b/src/modlistview.cpp @@ -29,6 +29,8 @@ void ModListView::dragMoveEvent(QDragMoveEvent* event) if (autoExpandDelay() >= 0) {
openTimer.start(autoExpandDelay(), this);
}
+
+ // bypass QTreeView
QAbstractItemView::dragMoveEvent(event);
}
|
