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.