本文整理汇总了Python中PyQt4.QtCore.QMimeData.part方法的典型用法代码示例。如果您正苦于以下问题:Python QMimeData.part方法的具体用法?Python QMimeData.part怎么用?Python QMimeData.part使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtCore.QMimeData
的用法示例。
在下文中一共展示了QMimeData.part方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: mouseMoveEvent
# 需要导入模块: from PyQt4.QtCore import QMimeData [as 别名]
# 或者: from PyQt4.QtCore.QMimeData import part [as 别名]
def mouseMoveEvent(self, e):
if self.drag_start is None:
pass
x = e.x() - self.drag_start.x()
y = e.y() - self.drag_start.y()
dist = QApplication.startDragDistance()
if not self.draggable or x > dist or y > dist:
return
drag = QDrag(self)
mime = QMimeData()
mime.setText(self.__class__.__name__)
mime.part = self
drag.setMimeData(mime)
pixmap = QPixmap.grabWidget(self)
pixmap.setAlphaChannel(pixmap)
drag.setPixmap(pixmap)
drag.setHotSpot(QPoint(drag.pixmap().width() / 2,
drag.pixmap().height()))
drag.start(Qt.CopyAction)
示例2: mouseMoveEvent
# 需要导入模块: from PyQt4.QtCore import QMimeData [as 别名]
# 或者: from PyQt4.QtCore.QMimeData import part [as 别名]
def mouseMoveEvent(self, e):
if self.drag_start is None:
pass
x = e.x() - self.drag_start[0]
y = e.y() - self.drag_start[1]
dist = QApplication.startDragDistance()
if (self.draggable is False) or (abs(x) < dist and abs(y) < dist):
return
drag = QDrag(self)
mime = QMimeData()
mime.setText(self.__class__.__name__)
mime.part = self
drag.setMimeData(mime)
pixmap = QPixmap.grabWidget(self)
pixmap.setAlphaChannel(pixmap)
drag.setPixmap(pixmap)
drag.setHotSpot(QPoint(drag.pixmap().width() / 2,
drag.pixmap().height()))
self.dragging = True
drag.start(Qt.CopyAction)