Helpviewer/History/HistoryModel.py

changeset 488
4174c2707dba
parent 13
1af94a91f439
child 791
9ec2ac20e54e
equal deleted inserted replaced
487:4d41d03d3d00 488:4174c2707dba
36 self.__headers = [ 36 self.__headers = [
37 self.trUtf8("Title"), 37 self.trUtf8("Title"),
38 self.trUtf8("Address"), 38 self.trUtf8("Address"),
39 ] 39 ]
40 40
41 self.connect(self.__historyManager, SIGNAL("historyReset()"), 41 self.__historyManager.historyReset.connect(self.historyReset)
42 self.historyReset) 42 self.__historyManager.entryRemoved.connect(self.historyReset)
43 self.connect(self.__historyManager, SIGNAL("entryRemoved"), 43 self.__historyManager.entryAdded.connect(self.entryAdded)
44 self.historyReset) 44 self.__historyManager.entryUpdated.connect(self.entryUpdated)
45 self.connect(self.__historyManager, SIGNAL("entryAdded"),
46 self.entryAdded)
47 self.connect(self.__historyManager, SIGNAL("entryUpdated(int)"),
48 self.entryUpdated)
49 45
50 def historyReset(self): 46 def historyReset(self):
51 """ 47 """
52 Public slot to reset the model. 48 Public slot to reset the model.
53 """ 49 """
65 Public slot to handle the update of a history entry. 61 Public slot to handle the update of a history entry.
66 62
67 @param row row number of the updated entry (integer) 63 @param row row number of the updated entry (integer)
68 """ 64 """
69 idx = self.index(row, 0) 65 idx = self.index(row, 0)
70 self.emit(SIGNAL("dataChanged(const QModelIndex&, const QModelIndex&)"), 66 self.dataChanged.emit(idx, idx)
71 idx, idx)
72 67
73 def headerData(self, section, orientation, role = Qt.DisplayRole): 68 def headerData(self, section, orientation, role = Qt.DisplayRole):
74 """ 69 """
75 Public method to get the header data. 70 Public method to get the header data.
76 71
159 lastRow = row + count - 1 154 lastRow = row + count - 1
160 self.beginRemoveRows(parent, row, lastRow) 155 self.beginRemoveRows(parent, row, lastRow)
161 lst = self.__historyManager.history()[:] 156 lst = self.__historyManager.history()[:]
162 for index in range(lastRow, row - 1, -1): 157 for index in range(lastRow, row - 1, -1):
163 del lst[index] 158 del lst[index]
164 self.disconnect(self.__historyManager, SIGNAL("historyReset()"), 159 self.__historyManager.historyReset.disconnect(self.historyReset)
165 self.historyReset)
166 self.__historyManager.setHistory(lst) 160 self.__historyManager.setHistory(lst)
167 self.connect(self.__historyManager, SIGNAL("historyReset()"), 161 self.__historyManager.historyReset.connect(self.historyReset)
168 self.historyReset)
169 self.endRemoveRows() 162 self.endRemoveRows()
170 return True 163 return True

eric ide

mercurial