forked from qt-creator/qt-creator
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:
@@ -80,6 +80,7 @@ public:
|
|||||||
mainLayout->addWidget(buttonBox);
|
mainLayout->addWidget(buttonBox);
|
||||||
|
|
||||||
m_view.setHeaderLabel(varName);
|
m_view.setHeaderLabel(varName);
|
||||||
|
m_view.setDragDropMode(QAbstractItemView::InternalMove);
|
||||||
const QStringList pathList = paths.split(Utils::HostOsInfo::pathListSeparator(),
|
const QStringList pathList = paths.split(Utils::HostOsInfo::pathListSeparator(),
|
||||||
QString::SkipEmptyParts);
|
QString::SkipEmptyParts);
|
||||||
for (const QString &path : pathList)
|
for (const QString &path : pathList)
|
||||||
@@ -125,7 +126,8 @@ private:
|
|||||||
void addPath(const QString &path)
|
void addPath(const QString &path)
|
||||||
{
|
{
|
||||||
const auto item = new QTreeWidgetItem(&m_view, {QDir::toNativeSeparators(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;
|
QTreeWidget m_view;
|
||||||
|
Reference in New Issue
Block a user