本文整理汇总了Python中PyQt4.QtGui.QTabBar.minimumSizeHint方法的典型用法代码示例。如果您正苦于以下问题:Python QTabBar.minimumSizeHint方法的具体用法?Python QTabBar.minimumSizeHint怎么用?Python QTabBar.minimumSizeHint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QTabBar
的用法示例。
在下文中一共展示了QTabBar.minimumSizeHint方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: E4SideBar
# 需要导入模块: from PyQt4.QtGui import QTabBar [as 别名]
# 或者: from PyQt4.QtGui.QTabBar import minimumSizeHint [as 别名]
#.........这里部分代码省略.........
"""
self.__delayTimer.setInterval(delay)
def delay(self):
"""
Public method to get the delay value for the expand/shrink delay in milliseconds.
@return value for the expand/shrink delay in milliseconds (integer)
"""
return self.__delayTimer.interval()
def __cancelDelayTimer(self):
"""
Private method to cancel the current delay timer.
"""
self.__delayTimer.stop()
self.__actionMethod = None
def shrink(self):
"""
Public method to record a shrink request.
"""
self.__delayTimer.stop()
self.__actionMethod = self.__shrinkIt
self.__delayTimer.start()
def __shrinkIt(self):
"""
Private method to shrink the sidebar.
"""
self.__minimized = True
self.__bigSize = self.size()
if self.__orientation in [E4SideBar.North, E4SideBar.South]:
self.__minSize = self.minimumSizeHint().height()
self.__maxSize = self.maximumHeight()
else:
self.__minSize = self.minimumSizeHint().width()
self.__maxSize = self.maximumWidth()
if self.splitter:
self.splitterSizes = self.splitter.sizes()
self.__stackedWidget.hide()
if self.__orientation in [E4SideBar.North, E4SideBar.South]:
self.setFixedHeight(self.__tabBar.minimumSizeHint().height())
else:
self.setFixedWidth(self.__tabBar.minimumSizeHint().width())
self.__actionMethod = None
def expand(self):
"""
Private method to record a expand request.
"""
self.__delayTimer.stop()
self.__actionMethod = self.__expandIt
self.__delayTimer.start()
def __expandIt(self):
"""
Public method to expand the sidebar.
"""
self.__minimized = False
self.__stackedWidget.show()
self.resize(self.__bigSize)
if self.__orientation in [E4SideBar.North, E4SideBar.South]:
示例2: SideBar
# 需要导入模块: from PyQt4.QtGui import QTabBar [as 别名]
# 或者: from PyQt4.QtGui.QTabBar import minimumSizeHint [as 别名]
class SideBar( QWidget ):
""" Sidebar with a widget area which is hidden or shown.
On by clicking any tab, off by clicking the current tab.
"""
North = 0
East = 1
South = 2
West = 3
def __init__( self, orientation = 2, parent = None ):
QWidget.__init__( self, parent )
self.__tabBar = QTabBar()
self.__tabBar.setDrawBase( True )
self.__tabBar.setShape( QTabBar.RoundedNorth )
self.__tabBar.setFocusPolicy( Qt.NoFocus )
self.__tabBar.setUsesScrollButtons( True )
self.__tabBar.setElideMode( 1 )
self.__stackedWidget = QStackedWidget( self )
self.__stackedWidget.setContentsMargins( 0, 0, 0, 0 )
self.barLayout = QBoxLayout( QBoxLayout.LeftToRight )
self.barLayout.setMargin( 0 )
self.layout = QBoxLayout( QBoxLayout.TopToBottom )
self.layout.setMargin( 0 )
self.layout.setSpacing( 0 )
self.barLayout.addWidget( self.__tabBar )
self.layout.addLayout( self.barLayout )
self.layout.addWidget( self.__stackedWidget )
self.setLayout( self.layout )
self.__minimized = False
self.__minSize = 0
self.__maxSize = 0
self.__bigSize = QSize()
self.splitter = None
self.__tabBar.installEventFilter( self )
self.__orientation = orientation
self.setOrientation( orientation )
self.__tabBar.currentChanged.connect(
self.__stackedWidget.setCurrentIndex )
return
def setSplitter( self, splitter ):
""" Set the splitter managing the sidebar """
self.splitter = splitter
return
def __getIndex( self ):
" Provides the widget index in splitters "
if self.__orientation == SideBar.West:
return 0
if self.__orientation == SideBar.East:
return 2
if self.__orientation == SideBar.South:
return 1
return 0
def __getWidget( self ):
" Provides a reference to the widget "
return self.splitter.widget( self.__getIndex() )
def shrink( self ):
""" Shrink the sidebar """
if self.__minimized:
return
self.__minimized = True
self.__bigSize = self.size()
if self.__orientation in [ SideBar.North, SideBar.South ]:
self.__minSize = self.minimumHeight()
self.__maxSize = self.maximumHeight()
else:
self.__minSize = self.minimumWidth()
self.__maxSize = self.maximumWidth()
self.__stackedWidget.hide()
sizes = self.splitter.sizes()
selfIndex = self.__getIndex()
if self.__orientation in [ SideBar.North, SideBar.South ]:
newHeight = self.__tabBar.minimumSizeHint().height()
self.setFixedHeight( newHeight )
diff = sizes[ selfIndex ] - newHeight
sizes[ selfIndex ] = newHeight
else:
newWidth = self.__tabBar.minimumSizeHint().width()
self.setFixedWidth( newWidth )
diff = sizes[ selfIndex ] - newWidth
sizes[ selfIndex ] = newWidth
if selfIndex == 0:
sizes[ 1 ] += diff
#.........这里部分代码省略.........