38 Private slot handling a change of the registered user agent strings. |
38 Private slot handling a change of the registered user agent strings. |
39 """ |
39 """ |
40 self.beginResetModel() |
40 self.beginResetModel() |
41 self.endResetModel() |
41 self.endResetModel() |
42 |
42 |
43 def removeRows(self, row, count, parent=QModelIndex()): |
43 def removeRows(self, row, count, parent=None): |
44 """ |
44 """ |
45 Public method to remove entries from the model. |
45 Public method to remove entries from the model. |
46 |
46 |
47 @param row start row (integer) |
47 @param row start row (integer) |
48 @param count number of rows to remove (integer) |
48 @param count number of rows to remove (integer) |
49 @param parent parent index (QModelIndex) |
49 @param parent parent index (QModelIndex) |
50 @return flag indicating success (boolean) |
50 @return flag indicating success (boolean) |
51 """ |
51 """ |
|
52 if parent is None: |
|
53 parent = QModelIndex() |
|
54 |
52 if parent.isValid(): |
55 if parent.isValid(): |
53 return False |
56 return False |
54 |
57 |
55 if count <= 0: |
58 if count <= 0: |
56 return False |
59 return False |
66 # removeEngine emits changed() |
69 # removeEngine emits changed() |
67 #self.endRemoveRows() |
70 #self.endRemoveRows() |
68 |
71 |
69 return True |
72 return True |
70 |
73 |
71 def rowCount(self, parent=QModelIndex()): |
74 def rowCount(self, parent=None): |
72 """ |
75 """ |
73 Public method to get the number of rows of the model. |
76 Public method to get the number of rows of the model. |
74 |
77 |
75 @param parent parent index (QModelIndex) |
78 @param parent parent index (QModelIndex) |
76 @return number of rows (integer) |
79 @return number of rows (integer) |
77 """ |
80 """ |
|
81 if parent is None: |
|
82 parent = QModelIndex() |
|
83 |
78 if parent.isValid(): |
84 if parent.isValid(): |
79 return 0 |
85 return 0 |
80 else: |
86 else: |
81 return self.__manager.hostsCount() |
87 return self.__manager.hostsCount() |
82 |
88 |
83 def columnCount(self, parent=QModelIndex()): |
89 def columnCount(self, parent=None): |
84 """ |
90 """ |
85 Public method to get the number of columns of the model. |
91 Public method to get the number of columns of the model. |
86 |
92 |
87 @param parent parent index (QModelIndex) |
93 @param parent parent index (QModelIndex) (Unused) |
88 @return number of columns (integer) |
94 @return number of columns (integer) |
89 """ |
95 """ |
90 return len(self.__headers) |
96 return len(self.__headers) |
91 |
97 |
92 def data(self, index, role): |
98 def data(self, index, role): |