PyQt4:在QTabWidget中设置选项卡栏的大小 [英] PyQt4: Set size of the tab bar in QTabWidget
本文介绍了PyQt4:在QTabWidget中设置选项卡栏的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何更改QTabWidget中选项卡栏的高度?
How would you change the height of the tab bar in a QTabWidget?
推荐答案
您应该创建一个自定义的QTabBar
并覆盖其tabSizeHint
方法.然后使用QTabWidget.setTabBar
方法将自定义的QTabBar
设置为QTabWidget
的条形.
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.
这篇关于PyQt4:在QTabWidget中设置选项卡栏的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文