53 first = self.__treeModel.index(0, 0) |
53 first = self.__treeModel.index(0, 0) |
54 if not first.isValid(): |
54 if not first.isValid(): |
55 return 0 |
55 return 0 |
56 return min(self.__treeModel.rowCount(first), self.MOVEDROWS) |
56 return min(self.__treeModel.rowCount(first), self.MOVEDROWS) |
57 |
57 |
58 def columnCount(self, parent=QModelIndex()): |
58 def columnCount(self, parent=None): |
59 """ |
59 """ |
60 Public method to get the number of columns. |
60 Public method to get the number of columns. |
61 |
61 |
62 @param parent index of parent (QModelIndex) |
62 @param parent index of parent (QModelIndex) |
63 @return number of columns (integer) |
63 @return number of columns (integer) |
64 """ |
64 """ |
|
65 if parent is None: |
|
66 parent = QModelIndex() |
|
67 |
65 return self.__treeModel.columnCount(self.mapToSource(parent)) |
68 return self.__treeModel.columnCount(self.mapToSource(parent)) |
66 |
69 |
67 def rowCount(self, parent=QModelIndex()): |
70 def rowCount(self, parent=None): |
68 """ |
71 """ |
69 Public method to determine the number of rows. |
72 Public method to determine the number of rows. |
70 |
73 |
71 @param parent index of parent (QModelIndex) |
74 @param parent index of parent (QModelIndex) |
72 @return number of rows (integer) |
75 @return number of rows (integer) |
73 """ |
76 """ |
|
77 if parent is None: |
|
78 parent = QModelIndex() |
|
79 |
74 if parent.column() > 0: |
80 if parent.column() > 0: |
75 return 0 |
81 return 0 |
76 |
82 |
77 if not parent.isValid(): |
83 if not parent.isValid(): |
78 folders = self.sourceModel().rowCount() |
84 folders = self.sourceModel().rowCount() |
131 historyIndex = self.__treeModel.sourceModel()\ |
137 historyIndex = self.__treeModel.sourceModel()\ |
132 .index(proxyIndex.internalId(), proxyIndex.column()) |
138 .index(proxyIndex.internalId(), proxyIndex.column()) |
133 treeIndex = self.__treeModel.mapFromSource(historyIndex) |
139 treeIndex = self.__treeModel.mapFromSource(historyIndex) |
134 return treeIndex |
140 return treeIndex |
135 |
141 |
136 def index(self, row, column, parent=QModelIndex()): |
142 def index(self, row, column, parent=None): |
137 """ |
143 """ |
138 Public method to create an index. |
144 Public method to create an index. |
139 |
145 |
140 @param row row number for the index (integer) |
146 @param row row number for the index (integer) |
141 @param column column number for the index (integer) |
147 @param column column number for the index (integer) |
142 @param parent index of the parent item (QModelIndex) |
148 @param parent index of the parent item (QModelIndex) |
143 @return requested index (QModelIndex) |
149 @return requested index (QModelIndex) |
144 """ |
150 """ |
|
151 if parent is None: |
|
152 parent = QModelIndex() |
|
153 |
145 if row < 0 or \ |
154 if row < 0 or \ |
146 column < 0 or \ |
155 column < 0 or \ |
147 column >= self.columnCount(parent) or \ |
156 column >= self.columnCount(parent) or \ |
148 parent.column() > 0: |
157 parent.column() > 0: |
149 return QModelIndex() |
158 return QModelIndex() |