title: Get selected files' filenames from PYQT5 QListview in python
body: <p>I am having trouble retrieving the filenames from selected QListview, I want the get the names of the files I selected from my list so that I can open the files by calling the filenames I retrieved. However, this doesn't work...</p>
  
  <p>Also, how do I set a multi select mode and retrieve all the files' filenames selected??</p>
  
  <pre><code>from PyQt5 import QtCore, QtGui, QtWidgets
  import PandasModel
  import pandas as pd
  
  
  class Ui_MainWindow(object):
      def setupUi(self, MainWindow):
          MainWindow.setObjectName("MainWindow")
          MainWindow.resize(450, 550)
          self.centralwidget = QtWidgets.QWidget(MainWindow)
          self.centralwidget.setObjectName("centralwidget")
          MainWindow.setCentralWidget(self.centralwidget)
          self.listview = QtWidgets.QListView(self.centralwidget)
          self.listview.setGeometry(QtCore.QRect(10,10,400,300))
          self.listview.setObjectName("listview")
  
          path = r'\\desktop\file'
  
          self.fileModel = QtWidgets.QFileSystemModel(self.centralwidget)
          self.fileModel.setRootPath(path)
          self.fileModel.setFilter(QtCore.QDir.NoDotAndDotDot | QtCore.QDir.Files)
          self.listview.setModel(self.fileModel)
          self.listview.setRootIndex(self.fileModel.index(path))
          self.listview.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)
  
  
          self.pushButton = QtWidgets.QPushButton(self.centralwidget)
          self.pushButton.setObjectName("pushButton")
          self.pushButton.setGeometry(QtCore.QRect(300,380,100,20))
  
          self.retranslateUi(MainWindow)
          QtCore.QMetaObject.connectSlotsByName(MainWindow)
  
  
      def retranslateUi(self, MainWindow):
           _translate = QtCore.QCoreApplication.translate
           MainWindow.setWindowTitle(_translate("MainWindow", "App"))
  
           self.pushButton.setText(_translate("MainWindow", "Retrieve data"))
  
           self.pushButton.clicked.connect(self.btn_clk)
  
           MainWindow.show()
  
      def get_name(self,index):
          return index.data.toString
  
      def btn_clk(self,selected):
  
          filename =self.get_name(self.listview.clicked)
          print(filename)
  
          SecondWindow = QtWidgets.QMainWindow(MainWindow)
          self.SW = Ui_SecondWindow()
          self.SW.setupUi(SecondWindow)
  
          SecondWindow.show()
          df = pd.read_csv(filename)
          model = PandasModel(df)
          self.SW.tableView.setModel(model)
  
  class Ui_SecondWindow(object):
      def setupUi(self,SecondWindow):
          SecondWindow.setObjectName("SecondWindow")
          SecondWindow.resize(600, 400)
          self.centralwidget = QtWidgets.QWidget(SecondWindow)
          self.centralwidget.setObjectName("centralwidget")
          SecondWindow.setCentralWidget(self.centralwidget)
  
          self.tableView = QtWidgets.QTableView(self.centralwidget)
          self.tableView.setGeometry(QtCore.QRect(10,10,580,370))
  
          self.retranslateUi(SecondWindow)
          QtCore.QMetaObject.connectSlotsByName(SecondWindow)
  
      def retranslateUi(self,SecondWindow):
          _translate = QtCore.QCoreApplication.translate
          SecondWindow.setWindowTitle(_translate("SecondWindow", "Table"))
  
          SecondWindow.show()
  
  
  if __name__ == "__main__":
      import sys
      app = QtWidgets.QApplication(sys.argv)
      MainWindow = QtWidgets.QMainWindow()
      ui = Ui_MainWindow()
      ui.setupUi(MainWindow)
      MainWindow.show()
      sys.exit(app.exec_())
  </code></pre>