本文整理汇总了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)