本文整理汇总了Python中PyQt4.QtGui.QTabBar.dropEvent方法的典型用法代码示例。如果您正苦于以下问题:Python QTabBar.dropEvent方法的具体用法?Python QTabBar.dropEvent怎么用?Python QTabBar.dropEvent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QTabBar
的用法示例。
在下文中一共展示了QTabBar.dropEvent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: dropEvent
# 需要导入模块: from PyQt4.QtGui import QTabBar [as 别名]
# 或者: from PyQt4.QtGui.QTabBar import dropEvent [as 别名]
def dropEvent(self, event):
"""Override Qt method"""
mimeData = event.mimeData()
index_from = mimeData.data("source-index").toInt()[0]
index_to = self.tabAt(event.pos())
if mimeData.data("tabbar-id").toLong()[0] != id(self):
tabwidget_from = mimeData.data("tabwidget-id").toLong()[0]
self.emit(SIGNAL("move_tab(long,int,int)"),
tabwidget_from, index_from, index_to)
event.acceptProposedAction()
elif index_from != index_to:
self.emit(SIGNAL("move_tab(int,int)"), index_from, index_to)
event.acceptProposedAction()
QTabBar.dropEvent(self, event)
示例2: dropEvent
# 需要导入模块: from PyQt4.QtGui import QTabBar [as 别名]
# 或者: from PyQt4.QtGui.QTabBar import dropEvent [as 别名]
def dropEvent(self, event):
"""Override Qt method"""
mimeData = event.mimeData()
index_from = mimeData.data("source-index").toInt()[0]
index_to = self.tabAt(event.pos())
if index_to == -1:
index_to = self.count()
if mimeData.data("tabbar-id").toLong()[0] != id(self):
tabwidget_from = str(mimeData.data("tabwidget-id").toLong()[0])
# We pass self object ID as a QString, because otherwise it would
# depend on the platform: long for 64bit, int for 32bit. Replacing
# by long all the time is not working on some 32bit platforms
# (see Issue 1094, Issue 1098)
self.emit(SIGNAL("move_tab(QString,int,int)"),
tabwidget_from, index_from, index_to)
event.acceptProposedAction()
elif index_from != index_to:
self.emit(SIGNAL("move_tab(int,int)"), index_from, index_to)
event.acceptProposedAction()
QTabBar.dropEvent(self, event)