Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Fixing Tab-size in a QTabWidget

Fixing Tab-size in a QTabWidget

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 7.0k 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.
  • T Offline
    T Offline
    tesmai4
    wrote on last edited by
    #1

    I added a QTabWidget in my interface at design time.
    I am adding tabs to the widget at run time using the following code.

    @ tabWidget->setStyleSheet("QTabBar::tab { max-width: 100px; }");
    tabWidget->addTab(new QWidget(),fileName);@

    I need to fix the size of a Tab. Above style sheet is not working and QTabWidget does not follow this max-width restriction.
    Am I missing something in my code or Is there another way of doing this?

    Any help is appreciated.

    1 Reply Last reply
    0
    • T Offline
      T Offline
      tzander
      wrote on last edited by
      #2

      Maybe try with;
      @
      tabWidget->setExpanding (false);
      @

      1 Reply Last reply
      0

      • Login

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