PathListDialog: Make entries movable

Quite often, I edit path lists in order to modify the order of entries.
It is nice to do this with via drag and drop in the PathListDialog.

Fixes: QTCREATORBUG-20965
Change-Id: I02492c537de694071822d4f261347acea46b220b
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Alessandro Portale
2020-06-15 18:09:32 +02:00
parent 0861ba2fc9
commit 592e20cf0f

View File

@@ -80,6 +80,7 @@ public:
mainLayout->addWidget(buttonBox);
m_view.setHeaderLabel(varName);
m_view.setDragDropMode(QAbstractItemView::InternalMove);
const QStringList pathList = paths.split(Utils::HostOsInfo::pathListSeparator(),
QString::SkipEmptyParts);
for (const QString &path : pathList)
@@ -125,7 +126,8 @@ private:
void addPath(const QString &path)
{
const auto item = new QTreeWidgetItem(&m_view, {QDir::toNativeSeparators(path)});
item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable);
item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable
| Qt::ItemIsDragEnabled);
}
QTreeWidget m_view;