forked from mirror/openmw-tes3mp
Prevent dropping item on itself in ContentModel (Fixes #2334)
Also improves the drop indicator, it is now shown in between items instead of on an item.
This commit is contained in:
parent
955505c167
commit
ab9100fa90
3 changed files with 5 additions and 6 deletions
|
@ -15,8 +15,7 @@ ContentSelectorModel::ContentModel::ContentModel(QObject *parent, QIcon warningI
|
||||||
mMimeType ("application/omwcontent"),
|
mMimeType ("application/omwcontent"),
|
||||||
mMimeTypes (QStringList() << mMimeType),
|
mMimeTypes (QStringList() << mMimeType),
|
||||||
mColumnCount (1),
|
mColumnCount (1),
|
||||||
mDragDropFlags (Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled),
|
mDropActions (Qt::MoveAction)
|
||||||
mDropActions (Qt::CopyAction | Qt::MoveAction)
|
|
||||||
{
|
{
|
||||||
setEncoding ("win1252");
|
setEncoding ("win1252");
|
||||||
uncheckAll();
|
uncheckAll();
|
||||||
|
@ -104,7 +103,7 @@ QModelIndex ContentSelectorModel::ContentModel::indexFromItem(const EsmFile *ite
|
||||||
Qt::ItemFlags ContentSelectorModel::ContentModel::flags(const QModelIndex &index) const
|
Qt::ItemFlags ContentSelectorModel::ContentModel::flags(const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
if (!index.isValid())
|
if (!index.isValid())
|
||||||
return Qt::NoItemFlags;
|
return Qt::ItemIsDropEnabled;
|
||||||
|
|
||||||
const EsmFile *file = item(index.row());
|
const EsmFile *file = item(index.row());
|
||||||
|
|
||||||
|
@ -152,7 +151,7 @@ Qt::ItemFlags ContentSelectorModel::ContentModel::flags(const QModelIndex &index
|
||||||
if (gamefileChecked)
|
if (gamefileChecked)
|
||||||
{
|
{
|
||||||
if (allDependenciesFound)
|
if (allDependenciesFound)
|
||||||
returnFlags = returnFlags | Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | mDragDropFlags;
|
returnFlags = returnFlags | Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsDragEnabled;
|
||||||
else
|
else
|
||||||
returnFlags = Qt::ItemIsSelectable;
|
returnFlags = Qt::ItemIsSelectable;
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,7 +89,6 @@ namespace ContentSelectorModel
|
||||||
QString mMimeType;
|
QString mMimeType;
|
||||||
QStringList mMimeTypes;
|
QStringList mMimeTypes;
|
||||||
int mColumnCount;
|
int mColumnCount;
|
||||||
Qt::ItemFlags mDragDropFlags;
|
|
||||||
Qt::DropActions mDropActions;
|
Qt::DropActions mDropActions;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,8 @@
|
||||||
ContentSelectorView::ContentSelector::ContentSelector(QWidget *parent) :
|
ContentSelectorView::ContentSelector::ContentSelector(QWidget *parent) :
|
||||||
QObject(parent)
|
QObject(parent)
|
||||||
{
|
{
|
||||||
ui.setupUi (parent);
|
ui.setupUi(parent);
|
||||||
|
ui.addonView->setDragDropMode(QAbstractItemView::InternalMove);
|
||||||
|
|
||||||
buildContentModel();
|
buildContentModel();
|
||||||
buildGameFileView();
|
buildGameFileView();
|
||||||
|
|
Loading…
Reference in a new issue