def startDrag(self, data): """ Starts dragging information from this chart widget based on the dragData associated with this item. """ if not data: return widget = self.scene().chartWidget() drag = QDrag(widget) drag.setMimeData(data) drag.exec_()
def startDrag(self, dragData): """ Starts a new drag with the inputed data. :param dragData | <dict> """ # create the mime data mimeData = QMimeData() for key, value in dragData.items(): mimeData.setData('application/x-%s' % key, wrapVariant(value)) # create the drag instance drag = QDrag(self.scene().chart()) drag.setMimeData(mimeData) drag.exec_()
def mousePressEvent(self, event): btn = event.button() mid = btn == Qt.MidButton lft = btn == Qt.LeftButton shft = event.modifiers() == Qt.ShiftModifier if self.windowFlags() & Qt.Dialog and \ (mid or (lft and shft)): pixmap = QPixmap.grabWidget(self) drag = QDrag(self) data = QMimeData() data.setData('x-application/xview/floating_view',\ QByteArray(self.objectName())) drag.setMimeData(data) drag.setPixmap(pixmap) self.hide() drag.exec_() self.show() else: super(XView, self).mousePressEvent(event)