def __init__(self, *args): #QWidget.__init__(self, *args) super(MyWindow, self).__init__(*args) self.ui = Ui_Dialog() self.ui.setupUi(self) # create table list_data = [1, 2, 3, 4] lm = MyListModel(list_data, self) # set the model self.ui.listView.setModel(lm)
class MyWindow(QWidget): def __init__(self, *args): #QWidget.__init__(self, *args) super(MyWindow, self).__init__(*args) self.ui = Ui_Dialog() self.ui.setupUi(self) # create table list_data = [1, 2, 3, 4] lm = MyListModel(list_data, self) # set the model self.ui.listView.setModel(lm) def accept(self): print self.ui.listView.model().listdata def reject(self): pass
class MyWindow(QWidget): def __init__(self, *args): #QWidget.__init__(self, *args) super(MyWindow, self).__init__(*args) self.ui = Ui_Dialog() self.ui.setupUi(self) # create table list_data = [1,2,3,4] lm = MyListModel(list_data, self) # set the model self.ui.listView.setModel(lm) def accept(self): print self.ui.listView.model().listdata def reject(self): pass
def __init__(self, *args): #QWidget.__init__(self, *args) super(MyWindow, self).__init__(*args) self.ui = Ui_Dialog() self.ui.setupUi(self) # create table list_data = [1,2,3,4] lm = MyListModel(list_data, self) # set the model self.ui.listView.setModel(lm)