142 @type bool |
142 @type bool |
143 """ |
143 """ |
144 if not index.isValid(): |
144 if not index.isValid(): |
145 return |
145 return |
146 |
146 |
147 if selected: |
147 flags = ( |
148 flags = QItemSelectionModel.SelectionFlags( |
148 QItemSelectionModel.SelectionFlags( |
149 QItemSelectionModel.SelectionFlag.ClearAndSelect | |
149 QItemSelectionModel.SelectionFlag.ClearAndSelect | |
150 QItemSelectionModel.SelectionFlag.Rows |
150 QItemSelectionModel.SelectionFlag.Rows |
151 ) |
151 ) |
152 else: |
152 if selected else |
153 flags = QItemSelectionModel.SelectionFlags( |
153 QItemSelectionModel.SelectionFlags( |
154 QItemSelectionModel.SelectionFlag.Deselect | |
154 QItemSelectionModel.SelectionFlag.Deselect | |
155 QItemSelectionModel.SelectionFlag.Rows |
155 QItemSelectionModel.SelectionFlag.Rows |
156 ) |
156 ) |
|
157 ) |
157 self.selectionModel().select(index, flags) |
158 self.selectionModel().select(index, flags) |
158 |
159 |
159 def __createPopupMenus(self): |
160 def __createPopupMenus(self): |
160 """ |
161 """ |
161 Private method to generate the popup menus. |
162 Private method to generate the popup menus. |