问题
How would you change the height of the tab bar in a QTabWidget?
回答1:
You should create a customized QTabBar
and overwrite its tabSizeHint
method. Then set that customised QTabBar
as the bar of your QTabWidget
using the QTabWidget.setTabBar
method.
I think the following (non tested) code could help you:
class TabBar(QTabBar):
def tabSizeHint(self, index):
width = QTabBar.tabSizeHint(self, index).width()
return QSize(width, your_wanted_height)
You can find other customization examples here.
来源:https://stackoverflow.com/questions/12428917/pyqt4-set-size-of-the-tab-bar-in-qtabwidget