PyQt4: Set size of the tab bar in QTabWidget

自闭症网瘾萝莉.ら 提交于 2019-12-12 03:35:18

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!