本文整理匯總了Python中PyQt4.QtGui.QTabBar.setSizePolicy方法的典型用法代碼示例。如果您正苦於以下問題:Python QTabBar.setSizePolicy方法的具體用法?Python QTabBar.setSizePolicy怎麽用?Python QTabBar.setSizePolicy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PyQt4.QtGui.QTabBar
的用法示例。
在下文中一共展示了QTabBar.setSizePolicy方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: E4SideBar
# 需要導入模塊: from PyQt4.QtGui import QTabBar [as 別名]
# 或者: from PyQt4.QtGui.QTabBar import setSizePolicy [as 別名]
#.........這裏部分代碼省略.........
def isTabEnabled(self, index):
"""
Public method to check, if a tab is enabled.
@param index index of the tab to check (integer)
@return flag indicating the enabled state (boolean)
"""
return self.__tabBar.isTabEnabled(index)
def setTabEnabled(self, index, enabled):
"""
Public method to set the enabled state of a tab.
@param index index of the tab to set (integer)
@param enabled enabled state to set (boolean)
"""
self.__tabBar.setTabEnabled(index, enabled)
def orientation(self):
"""
Public method to get the orientation of the sidebar.
@return orientation of the sidebar (North, East, South, West)
"""
return self.__orientation
def setOrientation(self, orient):
"""
Public method to set the orientation of the sidebar.
@param orient orientation of the sidebar (North, East, South, West)
"""
if orient == E4SideBar.North:
self.__tabBar.setShape(QTabBar.RoundedNorth)
self.__tabBar.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
self.barLayout.setDirection(QBoxLayout.LeftToRight)
self.layout.setDirection(QBoxLayout.TopToBottom)
self.layout.setAlignment(self.barLayout, Qt.AlignLeft)
elif orient == E4SideBar.East:
self.__tabBar.setShape(QTabBar.RoundedEast)
self.__tabBar.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding)
self.barLayout.setDirection(QBoxLayout.TopToBottom)
self.layout.setDirection(QBoxLayout.RightToLeft)
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)