當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。