Helpviewer/OpenSearch/OpenSearchEngineModel.py

changeset 5656
9c21b2746218
parent 5389
9b1c800daff3
child 6048
82ad8ec9548c
equal deleted inserted replaced
5654:d75dfc0d10f2 5656:9c21b2746218
35 self.__headers = [ 35 self.__headers = [
36 self.tr("Name"), 36 self.tr("Name"),
37 self.tr("Keywords"), 37 self.tr("Keywords"),
38 ] 38 ]
39 39
40 def removeRows(self, row, count, parent=QModelIndex()): 40 def removeRows(self, row, count, parent=None):
41 """ 41 """
42 Public method to remove entries from the model. 42 Public method to remove entries from the model.
43 43
44 @param row start row (integer) 44 @param row start row (integer)
45 @param count number of rows to remove (integer) 45 @param count number of rows to remove (integer)
46 @param parent parent index (QModelIndex) 46 @param parent parent index (QModelIndex)
47 @return flag indicating success (boolean) 47 @return flag indicating success (boolean)
48 """ 48 """
49 if parent is None:
50 parent = QModelIndex()
51
49 if parent.isValid(): 52 if parent.isValid():
50 return False 53 return False
51 54
52 if count <= 0: 55 if count <= 0:
53 return False 56 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.enginesCount() 87 return self.__manager.enginesCount()
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 2 96 return 2
91 97
92 def flags(self, index): 98 def flags(self, index):

eric ide

mercurial