E4Gui/E4ModelMenu.py

changeset 38
5fe2b7deab15
parent 13
1af94a91f439
equal deleted inserted replaced
37:bfe92e414977 38:5fe2b7deab15
314 parentIndex = self.__root 314 parentIndex = self.__root
315 if act is None: 315 if act is None:
316 row = self.__model.rowCount(self.__root) 316 row = self.__model.rowCount(self.__root)
317 else: 317 else:
318 idx = self.index(act) 318 idx = self.index(act)
319 assert idx.isValid() 319 if not idx.isValid():
320 QMenu.dropEvent(self, evt)
321 return
322
320 row = idx.row() 323 row = idx.row()
321 if self.__model.hasChildren(idx): 324 if self.__model.hasChildren(idx):
322 parentIndex = idx 325 parentIndex = idx
323 row = self.__model.rowCount(idx) 326 row = self.__model.rowCount(idx)
324 327
325 self.__dropRow = row 328 self.__dropRow = row
326 self.__dropIndex = parentIndex 329 self.__dropIndex = parentIndex
327 evt.acceptProposedAction() 330 evt.acceptProposedAction()
328 self.__model.dropMimeData(evt.mimeData(), evt.dropAction(), 331 self.__model.dropMimeData(evt.mimeData(), evt.dropAction(),
329 row, 0, parentIndex) 332 row, 0, parentIndex)
333 self.close()
330 334
331 QMenu.dropEvent(self, evt) 335 QMenu.dropEvent(self, evt)
332 336
333 def mousePressEvent(self, evt): 337 def mousePressEvent(self, evt):
334 """ 338 """

eric ide

mercurial