Skip to content
Permalink
Browse files

[Processing] Allow reordering of items in the MultipleInputDialog.

Based on QGIS 3.2.
  • Loading branch information
radosuav authored and nyalldawson committed Oct 15, 2018
1 parent d119c2d commit 3e41230d7c588a262f0ab9dc6c6d149530b0544d
Showing with 6 additions and 3 deletions.
  1. +6 −3 python/plugins/processing/gui/MultipleInputDialog.py
@@ -43,7 +43,8 @@ def __init__(self, options, selectedoptions=None):
super(MultipleInputDialog, self).__init__(None)
self.setupUi(self)

self.lstLayers.setSelectionMode(QAbstractItemView.NoSelection)
self.lstLayers.setSelectionMode(QAbstractItemView.ExtendedSelection)
self.lstLayers.setDragDropMode(QAbstractItemView.InternalMove)

self.options = options
self.selectedoptions = selectedoptions or []
@@ -69,19 +70,21 @@ def populateList(self):
model = QStandardItemModel()
for i, option in enumerate(self.options):
item = QStandardItem(option)
item.setData(i, Qt.UserRole)
item.setCheckState(Qt.Checked if i in self.selectedoptions else Qt.Unchecked)
item.setCheckable(True)
item.setDropEnabled(False)
model.appendRow(item)

self.lstLayers.setModel(model)

def accept(self):
self.selectedoptions = []
model = self.lstLayers.model()
for i in xrange(model.rowCount()):
for i in range(model.rowCount()):
item = model.item(i)
if item.checkState() == Qt.Checked:
self.selectedoptions.append(i)
self.selectedoptions.append(item.data(Qt.UserRole))
QDialog.accept(self)

def reject(self):

0 comments on commit 3e41230

Please sign in to comment.
You can’t perform that action at this time.