本文整理汇总了Python中PyQt4.QtGui.QTabBar.tabText方法的典型用法代码示例。如果您正苦于以下问题:Python QTabBar.tabText方法的具体用法?Python QTabBar.tabText怎么用?Python QTabBar.tabText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QTabBar
的用法示例。
在下文中一共展示了QTabBar.tabText方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: E4SideBar
# 需要导入模块: from PyQt4.QtGui import QTabBar [as 别名]
# 或者: from PyQt4.QtGui.QTabBar import tabText [as 别名]
#.........这里部分代码省略.........
self.layout.setAlignment(self.barLayout, Qt.AlignTop)
elif orient == E4SideBar.South:
self.__tabBar.setShape(QTabBar.RoundedSouth)
self.__tabBar.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
self.barLayout.setDirection(QBoxLayout.LeftToRight)
self.layout.setDirection(QBoxLayout.BottomToTop)
self.layout.setAlignment(self.barLayout, Qt.AlignLeft)
elif orient == E4SideBar.West:
self.__tabBar.setShape(QTabBar.RoundedWest)
self.__tabBar.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding)
self.barLayout.setDirection(QBoxLayout.TopToBottom)
self.layout.setDirection(QBoxLayout.LeftToRight)
self.layout.setAlignment(self.barLayout, Qt.AlignTop)
self.__orientation = orient
def tabIcon(self, index):
"""
Public method to get the icon of a tab.
@param index index of the tab (integer)
@return icon of the tab (QIcon)
"""
return self.__tabBar.tabIcon(index)
def setTabIcon(self, index, icon):
"""
Public method to set the icon of a tab.
@param index index of the tab (integer)
@param icon icon to be set (QIcon)
"""
self.__tabBar.setTabIcon(index, icon)
def tabText(self, index):
"""
Public method to get the text of a tab.
@param index index of the tab (integer)
@return text of the tab (QString)
"""
return self.__tabBar.tabText(index)
def setTabText(self, index, text):
"""
Public method to set the text of a tab.
@param index index of the tab (integer)
@param text text to set (QString)
"""
self.__tabBar.setTabText(index, text)
def tabToolTip(self, index):
"""
Public method to get the tooltip text of a tab.
@param index index of the tab (integer)
@return tooltip text of the tab (QString)
"""
return self.__tabBar.tabToolTip(index)
def setTabToolTip(self, index, tip):
"""
Public method to set the tooltip text of a tab.
@param index index of the tab (integer)
@param tooltip text text to set (QString)
示例2: SideBar
# 需要导入模块: from PyQt4.QtGui import QTabBar [as 别名]
# 或者: from PyQt4.QtGui.QTabBar import tabText [as 别名]
#.........这里部分代码省略.........
self.expand()
return
def indexOf( self, widget ):
""" Provides the index of the given widget """
return self.__stackedWidget.indexOf( widget )
def isTabEnabled( self, index ):
""" Check if the tab is enabled """
return self.__tabBar.isTabEnabled( index )
def setTabEnabled( self, index, enabled ):
""" Set the enabled state of the tab """
self.__tabBar.setTabEnabled( index, enabled )
return
def orientation( self ):
""" Provides the orientation of the sidebar """
return self.__orientation
def setOrientation( self, orient ):
""" Set the orientation of the sidebar """
if orient == SideBar.North:
self.__tabBar.setShape( QTabBar.RoundedNorth )
self.barLayout.setDirection( QBoxLayout.LeftToRight )
self.layout.setDirection( QBoxLayout.TopToBottom )
self.layout.setAlignment( self.barLayout, Qt.AlignLeft )
elif orient == SideBar.East:
self.__tabBar.setShape( QTabBar.RoundedEast )
self.barLayout.setDirection( QBoxLayout.TopToBottom )
self.layout.setDirection( QBoxLayout.RightToLeft )
self.layout.setAlignment( self.barLayout, Qt.AlignTop )
elif orient == SideBar.South:
self.__tabBar.setShape( QTabBar.RoundedSouth )
self.barLayout.setDirection( QBoxLayout.LeftToRight )
self.layout.setDirection( QBoxLayout.BottomToTop )
self.layout.setAlignment( self.barLayout, Qt.AlignLeft )
else:
# default
orient = SideBar.West
self.__tabBar.setShape( QTabBar.RoundedWest )
self.barLayout.setDirection( QBoxLayout.TopToBottom )
self.layout.setDirection( QBoxLayout.LeftToRight )
self.layout.setAlignment( self.barLayout, Qt.AlignTop )
self.__orientation = orient
return
def tabIcon( self, index ):
""" Provide the icon of the tab """
return self.__tabBar.tabIcon( index )
def setTabIcon( self, index, icon ):
""" Set the icon of the tab """
self.__tabBar.setTabIcon( index, icon )
return
def tabText( self, index ):
""" Provide the text of the tab """
return self.__tabBar.tabText( index )
def setTabText( self, index, text ):
""" Set the text of the tab """
self.__tabBar.setTabText( index, text )
return
def tabToolTip( self, index ):
""" Provide the tooltip text of the tab """
return self.__tabBar.tabToolTip( index )
def setTabToolTip( self, index, tip ):
""" Set the tooltip text of the tab """
self.__tabBar.setTabToolTip( index, tip )
return
def tabWhatsThis( self, index ):
""" Provide the WhatsThis text of the tab """
return self.__tabBar.tabWhatsThis( index )
def setTabWhatsThis( self, index, text ):
""" Set the WhatsThis text for the tab """
self.__tabBar.setTabWhatsThis( index, text )
return
def widget( self, index ):
""" Provides the reference to the widget (QWidget) """
return self.__stackedWidget.widget( index )