src/eric7/WebBrowser/History/HistoryModel.py

branch
eric7
changeset 10436
f6881d10e995
parent 9653
e67609152c5e
child 10439
21c28b0f9e41
equal deleted inserted replaced
10435:c712d09cc839 10436:f6881d10e995
30 def __init__(self, historyManager, parent=None): 30 def __init__(self, historyManager, parent=None):
31 """ 31 """
32 Constructor 32 Constructor
33 33
34 @param historyManager reference to the history manager object 34 @param historyManager reference to the history manager object
35 (HistoryManager) 35 @type HistoryManager
36 @param parent reference to the parent object (QObject) 36 @param parent reference to the parent object
37 @type QObject
37 """ 38 """
38 super().__init__(parent) 39 super().__init__(parent)
39 40
40 self.__historyManager = historyManager 41 self.__historyManager = historyManager
41 42
62 63
63 def entryUpdated(self, row): 64 def entryUpdated(self, row):
64 """ 65 """
65 Public slot to handle the update of a history entry. 66 Public slot to handle the update of a history entry.
66 67
67 @param row row number of the updated entry (integer) 68 @param row row number of the updated entry
69 @type int
68 """ 70 """
69 idx = self.index(row, 0) 71 idx = self.index(row, 0)
70 self.dataChanged.emit(idx, idx) 72 self.dataChanged.emit(idx, idx)
71 73
72 def headerData(self, section, orientation, role=Qt.ItemDataRole.DisplayRole): 74 def headerData(self, section, orientation, role=Qt.ItemDataRole.DisplayRole):
73 """ 75 """
74 Public method to get the header data. 76 Public method to get the header data.
75 77
76 @param section section number (integer) 78 @param section section number
77 @param orientation header orientation (Qt.Orientation) 79 @type int
78 @param role data role (Qt.ItemDataRole) 80 @param orientation header orientation
81 @type Qt.Orientation
82 @param role data role
83 @type Qt.ItemDataRole
79 @return header data 84 @return header data
85 @rtype Any
80 """ 86 """
81 if ( 87 if (
82 orientation == Qt.Orientation.Horizontal 88 orientation == Qt.Orientation.Horizontal
83 and role == Qt.ItemDataRole.DisplayRole 89 and role == Qt.ItemDataRole.DisplayRole
84 ): 90 ):
88 94
89 def data(self, index, role=Qt.ItemDataRole.DisplayRole): 95 def data(self, index, role=Qt.ItemDataRole.DisplayRole):
90 """ 96 """
91 Public method to get data from the model. 97 Public method to get data from the model.
92 98
93 @param index index of history entry to get data for (QModelIndex) 99 @param index index of history entry to get data for
94 @param role data role (integer) 100 @type QModelIndex
101 @param role data role
102 @type int
95 @return history entry data 103 @return history entry data
104 @rtype Any
96 """ 105 """
97 lst = self.__historyManager.history() 106 lst = self.__historyManager.history()
98 if index.row() < 0 or index.row() > len(lst): 107 if index.row() < 0 or index.row() > len(lst):
99 return None 108 return None
100 109
125 134
126 def columnCount(self, parent=None): 135 def columnCount(self, parent=None):
127 """ 136 """
128 Public method to get the number of columns. 137 Public method to get the number of columns.
129 138
130 @param parent index of parent (QModelIndex) 139 @param parent index of parent
131 @return number of columns (integer) 140 @type QModelIndex
141 @return number of columns
142 @rtype int
132 """ 143 """
133 if parent is None: 144 if parent is None:
134 parent = QModelIndex() 145 parent = QModelIndex()
135 146
136 if parent.isValid(): 147 if parent.isValid():
140 151
141 def rowCount(self, parent=None): 152 def rowCount(self, parent=None):
142 """ 153 """
143 Public method to determine the number of rows. 154 Public method to determine the number of rows.
144 155
145 @param parent index of parent (QModelIndex) 156 @param parent index of parent
146 @return number of rows (integer) 157 @type QModelIndex
158 @return number of rows
159 @rtype int
147 """ 160 """
148 if parent is None: 161 if parent is None:
149 parent = QModelIndex() 162 parent = QModelIndex()
150 163
151 if parent.isValid(): 164 if parent.isValid():
155 168
156 def removeRows(self, row, count, parent=None): 169 def removeRows(self, row, count, parent=None):
157 """ 170 """
158 Public method to remove history entries from the model. 171 Public method to remove history entries from the model.
159 172
160 @param row row of the first history entry to remove (integer) 173 @param row row of the first history entry to remove
161 @param count number of history entries to remove (integer) 174 @type int
162 @param parent index of the parent entry (QModelIndex) 175 @param count number of history entries to remove
163 @return flag indicating successful removal (boolean) 176 @type int
177 @param parent index of the parent entry
178 @type QModelIndex
179 @return flag indicating successful removal
180 @rtype bool
164 """ 181 """
165 if parent is None: 182 if parent is None:
166 parent = QModelIndex() 183 parent = QModelIndex()
167 184
168 if parent.isValid(): 185 if parent.isValid():

eric ide

mercurial