本文整理汇总了Python中PyQt4.QtGui.QTabBar.isTabEnabled方法的典型用法代码示例。如果您正苦于以下问题:Python QTabBar.isTabEnabled方法的具体用法?Python QTabBar.isTabEnabled怎么用?Python QTabBar.isTabEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QTabBar
的用法示例。
在下文中一共展示了QTabBar.isTabEnabled方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: E4SideBar
# 需要导入模块: from PyQt4.QtGui import QTabBar [as 别名]
# 或者: from PyQt4.QtGui.QTabBar import isTabEnabled [as 别名]
#.........这里部分代码省略.........
self.__tabBar.setCurrentIndex(index)
self.__stackedWidget.setCurrentIndex(index)
if self.isMinimized():
self.expand()
def currentWidget(self):
"""
Public method to get a reference to the current widget.
@return reference to the current widget (QWidget)
"""
return self.__stackedWidget.currentWidget()
def setCurrentWidget(self, widget):
"""
Public slot to set the current widget.
@param widget reference to the widget to become the current widget (QWidget)
"""
self.__stackedWidget.setCurrentWidget(widget)
self.__tabBar.setCurrentIndex(self.__stackedWidget.currentIndex())
if self.isMinimized():
self.expand()
def indexOf(self, widget):
"""
Public method to get the index of the given widget.
@param widget reference to the widget to get the index of (QWidget)
@return index of the given widget (integer)
"""
return self.__stackedWidget.indexOf(widget)
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)
示例2: SideBar
# 需要导入模块: from PyQt4.QtGui import QTabBar [as 别名]
# 或者: from PyQt4.QtGui.QTabBar import isTabEnabled [as 别名]
#.........这里部分代码省略.........
if selfIndex == 0:
sizes[ 1 ] -= diff
else:
sizes[ selfIndex - 1 ] -= diff
self.splitter.setSizes( sizes )
return
def isMinimized( self ):
""" Provides the minimized state """
return self.__minimized
def eventFilter( self, obj, evt ):
""" Handle click events for the tabbar """
if obj == self.__tabBar:
if evt.type() == QEvent.MouseButtonPress:
pos = evt.pos()
index = self.__tabBar.count() - 1
while index >= 0:
if self.__tabBar.tabRect( index ).contains( pos ):
break
index -= 1
if index == self.__tabBar.currentIndex():
if self.isMinimized():
self.expand()
else:
self.shrink()
return True
elif self.isMinimized():
if self.isTabEnabled( index ):
self.expand()
return QWidget.eventFilter( self, obj, evt )
def addTab( self, widget, iconOrLabel, label = None ):
""" Add a tab to the sidebar """
if label:
self.__tabBar.addTab( iconOrLabel, label )
else:
self.__tabBar.addTab( iconOrLabel )
self.__stackedWidget.addWidget( widget )
return
def insertTab( self, index, widget, iconOrLabel, label = None ):
""" Insert a tab into the sidebar """
if label:
self.__tabBar.insertTab( index, iconOrLabel, label )
else:
self.__tabBar.insertTab( index, iconOrLabel )
self.__stackedWidget.insertWidget( index, widget )
return
def removeTab( self, index ):
""" Remove a tab """
self.__stackedWidget.removeWidget( self.__stackedWidget.widget( index ) )
self.__tabBar.removeTab( index )
return
def clear( self ):