def mouseMoveEvent(self, e): """On drag, create a ModuleFrameMime containing the dock that contains this toolbar. """ drag = QDrag(self) drag.setMimeData(ModuleFrameMime(self.dock)) dropAction = drag.start(Qt.MoveAction)
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)
def mouseMoveEvent(self, e): if (e.buttons() == Qt.MidButton): # dropAction Doesn't work :( drag = QDrag(self) drag.setMimeData(ModuleFrameMime(self)) dropAction = drag.start(Qt.MoveAction) elif (e.modifiers() == Qt.ShiftModifier): # dropAction works here drag = QDrag(self) drag.setMimeData(ModuleFrameMime(self)) dropAction = drag.start(Qt.MoveAction) else: super(BFDockWidget, self).mouseMoveEvent(e)
def mousePressEvent( self, event ): # handle an internal move # start a drag event if event.button() == Qt.LeftButton and self.dragDropRect().contains(event.pos()): # create the pixmap pixmap = QPixmap.grabWidget(self, self.rect()) # create the mimedata mimeData = QMimeData() mimeData.setText('ItemTitle::%s' % (self.title())) # create the drag drag = QDrag(self) drag.setMimeData(mimeData) drag.setPixmap(pixmap) drag.setHotSpot(event.pos()) if not drag.exec_(): self._accordianWidget.emitItemDragFailed(self) event.accept() # determine if the expand/collapse should occur elif event.button() == Qt.LeftButton and self.expandCollapseRect().contains(event.pos()): self._clicked = True event.accept() else: event.ignore()
def mouseMoveEvent(self, e): if e.buttons() == Qt.MidButton: # dropAction Doesn't work :( drag = QDrag(self) drag.setMimeData(ModuleFrameMime(self)) dropAction = drag.start(Qt.MoveAction) elif e.modifiers() == Qt.ShiftModifier: # dropAction works here drag = QDrag(self) drag.setMimeData(ModuleFrameMime(self)) dropAction = drag.start(Qt.MoveAction) else: super(BFDockWidget, self).mouseMoveEvent(e)
def mouseMoveEvent(self, e): """Creates a QDrag object with a LabelTextMime containing this label's text. """ drag = QDrag(self) drag.setMimeData(LabelTextMime(self.text)) drag.setPixmap(QPixmap.fromImage(self.createPixmap())) dropAction = drag.start(Qt.MoveAction)
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)
def startDrag(self, actions): if self._editor.factory.drag_external: idxs = self.selectedIndexes() rows = sorted(list(set([idx.row() for idx in idxs]))) drag_object = [ (ri, self._editor.value[ri]) for ri in rows] md = PyMimeData.coerce(drag_object) self._dragging = self.currentIndex() drag = QDrag(self) drag.setMimeData(md) # drag.setPixmap(pm) # drag.setHotSpot(hspos) drag.exec_(actions) else: super(_myTableView, self).startDrag(actions)