def mouseMoveEvent(self, mme):
   if mme.button() == Qt.NoButton and self._drag_start: # for some reason, the left button is being mapped to NoButton
     drag_distance = mme.pos() - self._drag_start
     drag_distance = drag_distance.manhattanLength()
     if drag_distance > QApplication.startDragDistance():
       drag = QDrag(self)
       mime_data = QMimeData()
       mime_data.setText(self.label_spidername.text())
       drag.setMimeData(mime_data)
       drag.exec_(Qt.CopyAction | Qt.MoveAction)
   super(SpiderToolButton, self).mouseMoveEvent(mme)
Exemplo n.º 2
0
 def mouseMoveEvent(self, mme):
     if mme.button(
     ) == Qt.NoButton and self._drag_start:  # for some reason, the left button is being mapped to NoButton
         drag_distance = mme.pos() - self._drag_start
         drag_distance = drag_distance.manhattanLength()
         if drag_distance > QApplication.startDragDistance():
             drag = QDrag(self)
             mime_data = QMimeData()
             mime_data.setText(self.label_spidername.text())
             drag.setMimeData(mime_data)
             drag.exec_(Qt.CopyAction | Qt.MoveAction)
     super(SpiderToolButton, self).mouseMoveEvent(mme)
Exemplo n.º 3
0
 def mouseReleaseEvent(self, mre):
   if mre.button() == Qt.LeftButton:
     final_pos = mre.pos()
     distance = QPoint(final_pos.x() - self._pos_press_start.x(), final_pos.y() - self._pos_press_start.y())
     distance = distance.manhattanLength()
     if distance > QApplication.startDragDistance():
       # then move the widget. But I really want to know whether the new point is to the right or left to the old point
       if final_pos.x() > self._pos_press_start.x():
         self.prev()
       else:
         self.next()
   self.setCursor(Qt.CursorShape.ArrowCursor)
   super(DragEnabledCentralScroller, self).mouseReleaseEvent(mre)