本文整理匯總了Python中PyQt4.QtGui.QTabBar.setTabToolTip方法的典型用法代碼示例。如果您正苦於以下問題:Python QTabBar.setTabToolTip方法的具體用法?Python QTabBar.setTabToolTip怎麽用?Python QTabBar.setTabToolTip使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PyQt4.QtGui.QTabBar
的用法示例。
在下文中一共展示了QTabBar.setTabToolTip方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: E4SideBar
# 需要導入模塊: from PyQt4.QtGui import QTabBar [as 別名]
# 或者: from PyQt4.QtGui.QTabBar import setTabToolTip [as 別名]
#.........這裏部分代碼省略.........
for i in range(self.__tabBar.count()):
if self.__tabBar.tabRect(i).contains(pos):
break
if i == self.__tabBar.currentIndex():
if self.isMinimized():
self.expand()
else:
self.shrink()
return True
elif self.isMinimized():
self.expand()
elif evt.type() == QEvent.Wheel and not self.__stackedWidget.isHidden():
if evt.delta() > 0:
self.prevTab()
else:
self.nextTab()
return True
return QWidget.eventFilter(self, obj, evt)
def addTab(self, widget, iconOrLabel, label = None):
"""
Public method to add a tab to the sidebar.
@param widget reference to the widget to add (QWidget)
@param iconOrLabel reference to the icon or the labeltext of the tab
(QIcon, string or QString)
@param label the labeltext of the tab (string or QString) (only to be
used, if the second parameter is a QIcon)
"""
if label:
index = self.__tabBar.addTab(iconOrLabel, label)
self.__tabBar.setTabToolTip(index, label)
else:
index = self.__tabBar.addTab(iconOrLabel)
self.__tabBar.setTabToolTip(index, iconOrLabel)
self.__stackedWidget.addWidget(widget)
if self.__orientation in [E4SideBar.North, E4SideBar.South]:
self.__minSize = self.minimumSizeHint().height()
else:
self.__minSize = self.minimumSizeHint().width()
def insertTab(self, index, widget, iconOrLabel, label = None):
"""
Public method to insert a tab into the sidebar.
@param index the index to insert the tab at (integer)
@param widget reference to the widget to insert (QWidget)
@param iconOrLabel reference to the icon or the labeltext of the tab
(QIcon, string or QString)
@param label the labeltext of the tab (string or QString) (only to be
used, if the second parameter is a QIcon)
"""
if label:
index = self.__tabBar.insertTab(index, iconOrLabel, label)
self.__tabBar.setTabToolTip(index, label)
else:
index = self.__tabBar.insertTab(index, iconOrLabel)
self.__tabBar.setTabToolTip(index, iconOrLabel)
self.__stackedWidget.insertWidget(index, widget)
if self.__orientation in [E4SideBar.North, E4SideBar.South]:
self.__minSize = self.minimumSizeHint().height()
else:
self.__minSize = self.minimumSizeHint().width()
示例2: SideBar
# 需要導入模塊: from PyQt4.QtGui import QTabBar [as 別名]
# 或者: from PyQt4.QtGui.QTabBar import setTabToolTip [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 )