hey folks; I am trying to list photos on QlistView by browsing using Qfiledailoug... so far i was doing the following
filename = QtGui.QFileDialog.getOpenFileName(self, 'Open file','/home/') #this one calls the file dailoug for browsing filename = [] # this one is an array to hold selected files filename = listViewitem1() # this one is suppose to list the files on listview anyway i was getting an error saying that there is no global name for (listViewitem1), so i had to define a global function for it. here it's filename = QtGui.QFileDialog.getOpenFileName(self, 'Open file','/home/') filename = [] filename = listViewitem1(filename, self) class listViewitem1(QAbstractListModel): def __init__(self, datain, parent=None, *args): """ datain: a list where each item is a row """ QAbstractTableModel.__init__(self, parent, *args) self.filename = datain def rowCount(self, parent=QModelIndex()): return len(self.filename) def data(self, index, role): if index.isValid() and role == Qt.DisplayRole: return QVariant(self.filename[index.row()]) else: return QVariant() Then it runs with no errors but when i browse through my directory and select a file, nothing happens (no file is listed on QListView) and no errors occurred either. Any ideas will be so helpful Thank you -- View this message in context: http://www.nabble.com/QListView-Global-funcation-behaviour-tp22269640p22269640.html Sent from the PyQt mailing list archive at Nabble.com. _______________________________________________ PyQt mailing list PyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt