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. Changing QTabWidget header size
Forum Updated to NodeBB v4.3 + New Features

Changing QTabWidget header size

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 4.1k 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.
  • N Offline
    N Offline
    nicky j
    wrote on last edited by
    #1

    Hello,

    I would like to change the size of my tabs in my tabWidget. I read something like this:

    @tabWidget->setStyleSheet(
    "color:black;"
    "QTabBar::tab { height: 5px; width: 200px; }"
    );@
    but that does not work. What am I doing wrong?

    1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #2

      Use the following
      @tabWidget.setStyleSheet("QTabBar::tab { color:black; height: 50px; width: 100px; }");@

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      1 Reply Last reply
      0
      • N Offline
        N Offline
        nicky j
        wrote on last edited by
        #3

        It works, thank you! Out of curiosity, why does "color:black" have to be inside the QTabBar::tab brackets?

        Thanks!

        1 Reply Last reply
        0
        • dheerendraD Offline
          dheerendraD Offline
          dheerendra
          Qt Champions 2022
          wrote on last edited by
          #4

          If you put it breaks the stylesheet syntax. Hence you need to put the right CSS syntax.

          Dheerendra
          @Community Service
          Certified Qt Specialist
          http://www.pthinks.com

          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