本文整理汇总了Python中qtpy.QtWidgets.QApplication.startDragDistance方法的典型用法代码示例。如果您正苦于以下问题:Python QApplication.startDragDistance方法的具体用法?Python QApplication.startDragDistance怎么用?Python QApplication.startDragDistance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qtpy.QtWidgets.QApplication
的用法示例。
在下文中一共展示了QApplication.startDragDistance方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: mouseMoveEvent
# 需要导入模块: from qtpy.QtWidgets import QApplication [as 别名]
# 或者: from qtpy.QtWidgets.QApplication import startDragDistance [as 别名]
def mouseMoveEvent(self, event):
"""Override Qt method"""
if event.buttons() == Qt.MouseButtons(Qt.LeftButton) and \
(event.pos() - self.__drag_start_pos).manhattanLength() > \
QApplication.startDragDistance():
drag = QDrag(self)
mimeData = QMimeData()
# Converting id's to long to avoid an OverflowError with PySide
if PY2:
ancestor_id = long(id(self.ancestor))
parent_widget_id = long(id(self.parentWidget()))
self_id = long(id(self))
else:
ancestor_id = id(self.ancestor)
parent_widget_id = id(self.parentWidget())
self_id = id(self)
mimeData.setData("parent-id", QByteArray.number(ancestor_id))
mimeData.setData("tabwidget-id",
QByteArray.number(parent_widget_id))
mimeData.setData("tabbar-id", QByteArray.number(self_id))
mimeData.setData("source-index",
QByteArray.number(self.tabAt(self.__drag_start_pos)))
drag.setMimeData(mimeData)
drag.exec_()
QTabBar.mouseMoveEvent(self, event)
示例2: mouseMoveEvent
# 需要导入模块: from qtpy.QtWidgets import QApplication [as 别名]
# 或者: from qtpy.QtWidgets.QApplication import startDragDistance [as 别名]
def mouseMoveEvent(self, event):
"""Override Qt method"""
if event.buttons() == Qt.MouseButtons(Qt.LeftButton) and \
(event.pos() - self.__drag_start_pos).manhattanLength() > \
QApplication.startDragDistance():
drag = QDrag(self)
mimeData = QMimeData()
ancestor_id = to_text_string(id(self.ancestor))
parent_widget_id = to_text_string(id(self.parentWidget()))
self_id = to_text_string(id(self))
source_index = to_text_string(self.tabAt(self.__drag_start_pos))
mimeData.setData("parent-id", to_binary_string(ancestor_id))
mimeData.setData("tabwidget-id",
to_binary_string(parent_widget_id))
mimeData.setData("tabbar-id", to_binary_string(self_id))
mimeData.setData("source-index", to_binary_string(source_index))
drag.setMimeData(mimeData)
drag.exec_()
QTabBar.mouseMoveEvent(self, event)