From 592e20cf0fba245d94d101f0bf62b1c43d625b5a Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Mon, 15 Jun 2020 18:09:32 +0200 Subject: [PATCH] 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 --- src/plugins/projectexplorer/environmentwidget.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/projectexplorer/environmentwidget.cpp b/src/plugins/projectexplorer/environmentwidget.cpp index 517e840a959..d2417a81b26 100644 --- a/src/plugins/projectexplorer/environmentwidget.cpp +++ b/src/plugins/projectexplorer/environmentwidget.cpp @@ -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;