Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. How to modify the tab size?
Qt 6.11 is out! See what's new in the release blog

How to modify the tab size?

Scheduled Pinned Locked Moved Unsolved Qt for Python
2 Posts 2 Posters 744 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    afernandezody
    wrote on last edited by
    #1

    Hello,
    I was able to modify font size and type of a tab with stylesheets according to

    ...
            tabs = QTabWidget()
            tabs.setStyleSheet('''QTabBar::tab {font-size: 10pt; font-family: Verdana; font-weight: bold;}''')
    

    This works as intended but the problem is that when the content is large, many letters do not even show. I modified the last line as

    tabs.setStyleSheet('''QTabBar::tab {font-size: 10pt; font-family: Verdana; font-weight: bold; height: 50px; width: 100px;}''')
    

    Here, some tabs look oversized (e.g. "Data") whereas others are still not large enough (e.g. "A very long tag content ..."). I was wondering if there is some easy way to dynamically expand the tag size when the content is large. Thanks.

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      The default elide mode for tabs is defined by currently used style, but you can override it:

      tabs.setElideMode(Qt::TextElideMode::ElideNone);
      
      1 Reply Last reply
      2

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved