当前位置: 首页>>代码示例>>Python>>正文


Python QtGui.QTabBar类代码示例

本文整理汇总了Python中PyQt4.QtGui.QTabBar的典型用法代码示例。如果您正苦于以下问题:Python QTabBar类的具体用法?Python QTabBar怎么用?Python QTabBar使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了QTabBar类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

        def __init__( self, parent = None ):
            QTabBar.__init__( self, parent )

            self.lineEdit = self.FramelessLineEdit( self )
            self.currentTab = -1

            self.connect( self.lineEdit, SIGNAL( 'returnPressed()' ), self.slotReturnPressed )
开发者ID:Siddhant,项目名称:revkit-copy,代码行数:7,代码来源:RenamableTabWidget.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:Brainsciences,项目名称:luminoso,代码行数:7,代码来源:tabs.py

示例3: __init__

 def __init__(self, parent = None):
     """
     Constructor
     
     @param parent reference to the parent widget (QWidget)
     """
     QTabBar.__init__(self, parent)
     self._tabWidget = parent
开发者ID:usc-bbdl,项目名称:R01_HSC_cadaver_system,代码行数:8,代码来源:E4TabWidget.py

示例4: dragEnterEvent

 def dragEnterEvent(self, event):
     """Override Qt method"""
     mimeData = event.mimeData()
     formats = mimeData.formats()
     if formats.contains("parent-id") and \
        mimeData.data("parent-id").toLong()[0] == id(self.ancestor):
         event.acceptProposedAction()
     QTabBar.dragEnterEvent(self, event)
开发者ID:Brainsciences,项目名称:luminoso,代码行数:8,代码来源:tabs.py

示例5: __init__

    def __init__(self, parent=None, *args, **kwargs):
        """
        Reset tab text orientation on initialization

        :param width: Remove default width parameter in kwargs
        :param height: Remove default height parameter in kwargs
        """
        self.tabSize = QSize(kwargs.pop('width', 100), kwargs.pop('height', 25))
        QTabBar.__init__(self, parent, *args, **kwargs)
开发者ID:crossroadchurch,项目名称:paul,代码行数:9,代码来源:sourceselectform.py

示例6: mouseMoveEvent

 def mouseMoveEvent(self,event):
     index = 0
     while(index < self.count()):
         if self.tabRect(index).contains(event.pos(),True):
             self.hoveredTab = index
             self.repaint()
             break
         index += 1
     QTabBar.mouseMoveEvent(self,event)
开发者ID:siwenhu,项目名称:test_client_broadcast,代码行数:9,代码来源:tabwidget.py

示例7: __init__

 def __init__(self, parent):
     " init class custom tab bar "
     QTabBar.__init__(self, parent)
     self._editor = QLineEdit(self)
     self._editor.setToolTip(" Type a Tab Name ")
     self._editor.setWindowFlags(Qt.Popup)
     self._editor.setFocusProxy(self)
     self._editor.editingFinished.connect(self.handleEditingFinished)
     self._editor.installEventFilter(self)
开发者ID:juancarlospaco,项目名称:pyqt_app_template,代码行数:9,代码来源:pyqt_app_template.py

示例8: mouseDoubleClickEvent

        def mouseDoubleClickEvent( self, event ):
            QTabBar.mouseDoubleClickEvent( self, event )
            index = self.tabAt( event.pos() )
            if index < 0:
                self.lineEdit.hide()
                return

            self.currentTab = index
            self.lineEdit.show()
            self.lineEdit.setGeometry( self.tabRect( index ) )
            self.lineEdit.setText( self.tabText( index ) )
            self.lineEdit.setFocus()
            self.lineEdit.selectAll()
开发者ID:Siddhant,项目名称:revkit-copy,代码行数:13,代码来源:RenamableTabWidget.py

示例9: 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 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:Brainsciences,项目名称:luminoso,代码行数:14,代码来源:tabs.py

示例10: 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:Brainsciences,项目名称:luminoso,代码行数:16,代码来源:tabs.py

示例11: eventFilter

 def eventFilter(self, widget, event):
     " filter mouse, esc key,  events "
     if (event.type() == QEvent.MouseButtonPress and not self._editor.geometry().contains(event.globalPos())) or (
         event.type() == QEvent.KeyPress and event.key() == Qt.Key_Escape
     ):
         self._editor.hide()
         return True
     return QTabBar.eventFilter(self, widget, event)
开发者ID:juancarlospaco,项目名称:pyqt_app_template,代码行数:8,代码来源:pyqt_app_template.py

示例12: addWidgets

 def addWidgets(self):
     """Create main layout."""
     logger = self.logger
     logger.debug('adding widgets')
     layout = QVBoxLayout()
     self.setLayout(layout)
     layout.setSpacing(0)
     layout.setContentsMargins(0, 0, 0, 0)
     tabbar = QTabBar(self)
     tabbar.setFocusPolicy(Qt.NoFocus)
     tabbar.setVisible(False)
     tabbar.currentChanged.connect(self.changeVault)
     layout.addWidget(tabbar)
     self.tabbar = tabbar
     stack = QStackedWidget(self)
     layout.addWidget(stack)
     novault = NoVaultWidget(stack)
     stack.addWidget(novault)
     self.stack = stack
开发者ID:geertj,项目名称:bluepass,代码行数:19,代码来源:passwordview.py

示例13: 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
         ancestor_id = long(id(self.ancestor))
         parent_widget_id = long(id(self.parentWidget()))
         self_id = long(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:koll00,项目名称:Gui_SM,代码行数:20,代码来源:tabs.py

示例14: paintEvent

 def paintEvent(self,event):
     painter = QPainter(self)
     if self.hasUnderLine:
         rect = self.tabRect(self.hoveredTab)
         linesPath = QPainterPath()
         linesPath.moveTo(QPoint(rect.x()+10,rect.height()-5))
         linesPath.lineTo(QPoint(rect.x()-10+rect.width(),rect.height()-5))
         linesPath.closeSubpath()
         painter.setPen(QPen(QColor(170,200,200),6))
         painter.drawPath(linesPath)
         # 如果不是当前选中的页,在页标签下画线
         if self.hoveredTab != self.currentIndex ():
             if self.isTabEnabled(self.hoveredTab):
                 rect = self.tabRect(self.hoveredTab)
                 linesPath = QPainterPath()
                 linesPath.moveTo(QPoint(rect.x()+10,rect.height()-5))
                 linesPath.lineTo(QPoint(rect.x()-10+rect.width(),rect.height()-5))
                 linesPath.closeSubpath()
                 painter.setPen(QPen(QColor(170,200,200),6))
                 painter.drawPath(linesPath)
     QTabBar.paintEvent(self,event)
开发者ID:siwenhu,项目名称:test_client_broadcast,代码行数:21,代码来源:tabwidget.py

示例15: 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.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)
开发者ID:koll00,项目名称:Gui_SM,代码行数:22,代码来源:tabs.py


注:本文中的PyQt4.QtGui.QTabBar类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。