user1006989
user1006989

Reputation:

PyQt4: Change text size and font on QTabBar

How would you change the text size and font in a QTabWidget?

class TabBar(QtGui.QTabBar):
    def ???(self, ???):

Upvotes: 3

Views: 18940

Answers (1)

Avaris
Avaris

Reputation: 36725

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..

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:

myTabWidget.setStyleSheet('QTabBar { font-size: 18pt; font-family: Courier; }')

Upvotes: 9

Related Questions