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"),
|
||||
mMimeTypes (QStringList() << mMimeType),
|
||||
mColumnCount (1),
|
||||
mDragDropFlags (Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled),
|
||||
mDropActions (Qt::CopyAction | Qt::MoveAction)
|
||||
mDropActions (Qt::MoveAction)
|
||||
{
|
||||
setEncoding ("win1252");
|
||||
uncheckAll();
|
||||
|
@ -104,7 +103,7 @@ QModelIndex ContentSelectorModel::ContentModel::indexFromItem(const EsmFile *ite
|
|||
Qt::ItemFlags ContentSelectorModel::ContentModel::flags(const QModelIndex &index) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
return Qt::NoItemFlags;
|
||||
return Qt::ItemIsDropEnabled;
|
||||
|
||||
const EsmFile *file = item(index.row());
|
||||
|
||||
|
@ -152,7 +151,7 @@ Qt::ItemFlags ContentSelectorModel::ContentModel::flags(const QModelIndex &index
|
|||
if (gamefileChecked)
|
||||
{
|
||||
if (allDependenciesFound)
|
||||
returnFlags = returnFlags | Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | mDragDropFlags;
|
||||
returnFlags = returnFlags | Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsDragEnabled;
|
||||
else
|
||||
returnFlags = Qt::ItemIsSelectable;
|
||||
}
|
||||
|
|
|
@ -89,7 +89,6 @@ namespace ContentSelectorModel
|
|||
QString mMimeType;
|
||||
QStringList mMimeTypes;
|
||||
int mColumnCount;
|
||||
Qt::ItemFlags mDragDropFlags;
|
||||
Qt::DropActions mDropActions;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ ContentSelectorView::ContentSelector::ContentSelector(QWidget *parent) :
|
|||
QObject(parent)
|
||||
{
|
||||
ui.setupUi(parent);
|
||||
ui.addonView->setDragDropMode(QAbstractItemView::InternalMove);
|
||||
|
||||
buildContentModel();
|
||||
buildGameFileView();
|
||||
|
|
Loading…
Reference in a new issue