本文整理汇总了Python中spyderlib.qt.QtGui.QTabBar类的典型用法代码示例。如果您正苦于以下问题:Python QTabBar类的具体用法?Python QTabBar怎么用?Python QTabBar使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QTabBar类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: mouseMoveEvent
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)
开发者ID:MarvinLiu0810,项目名称:spyder,代码行数:25,代码来源:tabs.py
示例2: __init__
def __init__(self, parent, ancestor):
QTabBar.__init__(self, parent)
self.ancestor = ancestor
# Dragging tabs
self.__drag_start_pos = QPoint()
self.setAcceptDrops(True)
开发者ID:Micseb,项目名称:spyder,代码行数:7,代码来源:tabs.py
示例3: dragEnterEvent
def dragEnterEvent(self, event):
"""Override Qt method"""
mimeData = event.mimeData()
formats = list(mimeData.formats())
if "parent-id" in formats and mimeData.data("parent-id").toLong()[0] == id(self.ancestor):
event.acceptProposedAction()
QTabBar.dragEnterEvent(self, event)
开发者ID:gyenney,项目名称:Tools,代码行数:7,代码来源:tabs.py
示例4: __init__
def __init__(self, parent, ancestor):
QTabBar.__init__(self, parent)
self.ancestor = ancestor
# To style tabs on Mac
if sys.platform == 'darwin':
self.setObjectName('plugin-tab')
# Dragging tabs
self.__drag_start_pos = QPoint()
self.setAcceptDrops(True)
开发者ID:MarvinLiu0810,项目名称:spyder,代码行数:11,代码来源:tabs.py
示例5: dropEvent
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 = 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)
开发者ID:jromang,项目名称:retina-old,代码行数:16,代码来源:tabs.py
示例6: mouseMoveEvent
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()
mimeData.setData("parent-id", QByteArray.number(id(self.ancestor)))
mimeData.setData("tabwidget-id",
QByteArray.number(id(self.parentWidget())))
mimeData.setData("tabbar-id", QByteArray.number(id(self)))
mimeData.setData("source-index",
QByteArray.number(self.tabAt(self.__drag_start_pos)))
drag.setMimeData(mimeData)
drag.exec_()
QTabBar.mouseMoveEvent(self, event)
开发者ID:jromang,项目名称:retina-old,代码行数:16,代码来源:tabs.py
示例7: dropEvent
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.sig_move_tab[(str, int, int)].emit(tabwidget_from, index_from, index_to)
event.acceptProposedAction()
elif index_from != index_to:
self.sig_move_tab.emit(index_from, index_to)
event.acceptProposedAction()
QTabBar.dropEvent(self, event)
开发者ID:gyenney,项目名称:Tools,代码行数:21,代码来源:tabs.py
示例8: mousePressEvent
def mousePressEvent(self, event):
"""Reimplement Qt method"""
if event.button() == Qt.LeftButton:
self.__drag_start_pos = QPoint(event.pos())
QTabBar.mousePressEvent(self, event)
开发者ID:MarvinLiu0810,项目名称:spyder,代码行数:5,代码来源:tabs.py
注:本文中的spyderlib.qt.QtGui.QTabBar类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论