class ControlPanel(QtGui.QListView): phrase_selected = QtCore.pyqtSignal(object) def __init__(self, parent=None): QtGui.QListView.__init__(self, parent) self.list_model = PhrasesListModel() def set_xml(self, xml): self.list_model.set_xml(xml) self.setModel(self.list_model) self.selectionModel().currentRowChanged.connect(self._phrase_selected) def _phrase_selected(self, new_index, old_index): self.phrase_selected.emit(new_index)
def __init__(self, parent=None): QtGui.QListView.__init__(self, parent) self.list_model = PhrasesListModel()