rudiHammad

Untitled

Apr 12th, 2017
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.50 KB | None | 0 0
  1.     def dropEvent(self, event):
  2.         ''' Get the dropEvent.
  3.         Get the drop event for the QtreeWidget. If there is an item on
  4.         the drop, do whatever, bla bla bla'''
  5.  
  6.         if event.mimeData().hasUrls:
  7.             event.setDropAction(QtCore.Qt.CopyAction)
  8.             event.accept()
  9.            
  10.             tree2_selectedItem = myWin.ui.treeWidget_2.currentItem()
  11.             name = tree2_selectedItem.text(0)
  12.             item = QtGui.QTreeWidgetItem()
  13.             item.setText(0, tree2_selectedItem.text(0))
  14.  
  15.             # // Get the mouse position
  16.             qPoint = event.pos()
  17.             print qPoint, "<--- son las coordenadas"
  18.             # get the index from the mouse pos
  19.             itemAtDrop = self.itemAt(qPoint)
  20.            
  21.             # // Check items on the drop
  22.             if itemAtDrop:
  23.                 src = event.source()
  24.                 qModelIndex = self.indexFromItem(itemAtDrop)
  25.                 print qModelIndex, "<--- the qModelIndex"
  26.                 theRow = qModelIndex.row()
  27.  
  28.                 # // Get the rectangle
  29.                 labelIndex = self.model().index(theRow, 0, self.rootIndex())
  30.                 visRect = self.visualRect(labelIndex)
  31.                 # center of rectangle
  32.                 visRect_center =  visRect.center()
  33.                 print visRect_center, "<---- the center"
  34.                 visRect_center_Y = visRect_center.y()
  35.                 print visRect_center_Y, "<--- the Y center"
  36.                 qPoint_y = qPoint.y()
  37.                 print qPoint.y(),  "<--- the mouse Y drop"
Advertisement
Add Comment
Please, Sign In to add comment