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.
pull/470/head
scrawl 10 years ago
parent 955505c167
commit ab9100fa90

@ -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;
};
}

@ -15,7 +15,8 @@
ContentSelectorView::ContentSelector::ContentSelector(QWidget *parent) :
QObject(parent)
{
ui.setupUi (parent);
ui.setupUi(parent);
ui.addonView->setDragDropMode(QAbstractItemView::InternalMove);
buildContentModel();
buildGameFileView();

Loading…
Cancel
Save