diff options
| author | Tannin <devnull@localhost> | 2015-08-05 22:48:34 +0200 |
|---|---|---|
| committer | Tannin <devnull@localhost> | 2015-08-05 22:48:34 +0200 |
| commit | 8cf429a1dd0d99790f2564b3ad363788e224711a (patch) | |
| tree | c0a3296493cc8efba4835e6988248f6961953e10 /src | |
| parent | 643a50ad5a6f6851db63ece41a399d9783dc5acd (diff) | |
- bugfix: manual installer now cancels drag&drop when dropping on a subitem
- bugfix: objects dropped on the modlist were treated as mods when they weren't urls
Diffstat (limited to 'src')
| -rw-r--r-- | src/modlist.cpp | 11 | ||||
| -rw-r--r-- | src/modlist.h | 1 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/modlist.cpp b/src/modlist.cpp index 59bd8979..fa34004d 100644 --- a/src/modlist.cpp +++ b/src/modlist.cpp @@ -587,6 +587,12 @@ QStringList ModList::mimeTypes() const return result;
}
+QMimeData *ModList::mimeData(const QModelIndexList &indexes) const
+{
+ QMimeData *result = QAbstractItemModel::mimeData(indexes);
+ result->setData("text/plain", "mod");
+ return result;
+}
void ModList::changeModPriority(std::vector<int> sourceIndices, int newPriority)
{
@@ -824,7 +830,6 @@ bool ModList::dropURLs(const QMimeData *mimeData, int row, const QModelIndex &pa return true;
}
-
bool ModList::dropMod(const QMimeData *mimeData, int row, const QModelIndex &parent)
{
@@ -877,9 +882,10 @@ bool ModList::dropMimeData(const QMimeData *mimeData, Qt::DropAction action, int }
if (m_Profile == nullptr) return false;
+
if (mimeData->hasUrls()) {
return dropURLs(mimeData, row, parent);
- } else {
+ } else if (mimeData->hasText()) {
return dropMod(mimeData, row, parent);
}
}
@@ -1141,3 +1147,4 @@ bool ModList::eventFilter(QObject *obj, QEvent *event) }
return QAbstractItemModel::eventFilter(obj, event);
}
+
diff --git a/src/modlist.h b/src/modlist.h index ed52a3ea..358fd583 100644 --- a/src/modlist.h +++ b/src/modlist.h @@ -150,6 +150,7 @@ public: // implementation of virtual functions of QAbstractItemModel virtual Qt::ItemFlags flags(const QModelIndex &modelIndex) const;
virtual Qt::DropActions supportedDropActions() const { return Qt::MoveAction | Qt::CopyAction; }
virtual QStringList mimeTypes() const;
+ virtual QMimeData *mimeData(const QModelIndexList &indexes) const;
virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent);
virtual bool removeRows(int row, int count, const QModelIndex &parent);
|
