QFileDialog as editor for TableView: how to get result?
问题 I'm using a QFileDialog as the editor for some columns in a QTableView . This basically works (modulo some focus issues, see here): class DirectorySelectionDelegate(QStyledItemDelegate): def createEditor(self, parent, option, index): editor = QFileDialog(parent) editor.setFileMode(QFileDialog.Directory) editor.setModal(True) return editor def setEditorData(self, editor, index): val = index.model().data(index, Qt.DisplayRole) fs = val.rsplit(os.path.sep, 1) if len(fs) == 2: bdir, vdir = fs