[英]PyQt4: Change text size and font on QTabBar
How would you change the text size and font in a QTabWidget? 您将如何更改QTabWidget中的文本大小和字体?
class TabBar(QtGui.QTabBar):
def ???(self, ???):
With a stylesheet. 带有样式表。 You don't need to subclass for that. 您不需要为此子类化。 But from your previous question , you are doing that already. 但是从上一个问题开始 ,您已经在这样做了。 You might as well put this in the __init__
too.. 您也可以将其放在__init__
。
class TabBar(QtGui.QTabBar):
def __init__(self, parent=None):
super(TabBar, self).__init__(parent)
self.setStyleSheet('font-size: 18pt; font-family: Courier;')
If you don't want to use a custom QTabBar
the equivalent would be setting the stylesheet on relevant QTabWidget
with a selector of QTabBar
: 如果您不想使用自定义QTabBar
则等效的方法是使用选择器QTabBar
在相关的QTabWidget
上设置样式表:
myTabWidget.setStyleSheet('QTabBar { font-size: 18pt; font-family: Courier; }')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.