Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def dropEvent(self, event):
- ''' Get the dropEvent.
- Get the drop event for the QtreeWidget. If there is an item on
- the drop, do whatever, bla bla bla'''
- if event.mimeData().hasUrls:
- event.setDropAction(QtCore.Qt.CopyAction)
- event.accept()
- tree2_selectedItem = myWin.ui.treeWidget_2.currentItem()
- name = tree2_selectedItem.text(0)
- item = QtGui.QTreeWidgetItem()
- item.setText(0, tree2_selectedItem.text(0))
- # // Get the mouse position
- qPoint = event.pos()
- print qPoint, "<--- son las coordenadas"
- # get the index from the mouse pos
- itemAtDrop = self.itemAt(qPoint)
- # // Check items on the drop
- if itemAtDrop:
- src = event.source()
- qModelIndex = self.indexFromItem(itemAtDrop)
- print qModelIndex, "<--- the qModelIndex"
- theRow = qModelIndex.row()
- # // Get the rectangle
- labelIndex = self.model().index(theRow, 0, self.rootIndex())
- visRect = self.visualRect(labelIndex)
- # center of rectangle
- visRect_center = visRect.center()
- print visRect_center, "<---- the center"
- visRect_center_Y = visRect_center.y()
- print visRect_center_Y, "<--- the Y center"
- qPoint_y = qPoint.y()
- print qPoint.y(), "<--- the mouse Y drop"
Advertisement
Add Comment
Please, Sign In to add comment