Heya

I'm trying to get a list of items from 1 listview and add them to another listview and then use it in rest of my script.

The way I thought to do it is to get listView_A >indexes > convert to names > add names to listView_B > execute script with names in listview_B (so I have to convert it again from indexes to names)

Now I don't know how to convert indexes to name. I found few clues but nothing worked.


Creation of UI
Qt Code:
  1. data = QtCore.QStringList()
  2. data << " "
  3.  
  4. self.listView = QtGui.QListView(self)
  5. self.listView.setGeometry(40,80,400,300)
  6. self.listView.clicked.connect(self.on_treeView_clicked)
  7. self.listView.setSelectionMode(QAbstractItemView.MultiSelection)
  8. model = QtGui.QStringListModel(data)
  9.  
  10. self.listView.setModel(model)
To copy to clipboard, switch view to plain text mode 

Getting list of items
Qt Code:
  1. def getLoc(self):
  2. file = str(QFileDialog.getExistingDirectory(self, "Select Directory"))
  3. loc = file
  4. self.lbl.setText(loc)
  5. location = file
  6. fileList = os.listdir(location)
  7. data = QtCore.QStringList()
  8. data << fileList
  9. model = QtGui.QStringListModel(data)
  10. self.listView.setModel(model)
To copy to clipboard, switch view to plain text mode 

And my attempt at converting indexes to strings :
Qt Code:
  1. @QtCore.pyqtSlot(QtCore.QModelIndex)
  2. def on_treeView_clicked(self, index):
  3. itms = self.listView.selectedIndexes()
  4. for data in itms:
  5. print data.row()
To copy to clipboard, switch view to plain text mode