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. How to change the image background of each QTabBar in my QTabWidget
Forum Updated to NodeBB v4.3 + New Features

How to change the image background of each QTabBar in my QTabWidget

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.1k Views 2 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.
  • E Offline
    E Offline
    el yousfi
    wrote on last edited by
    #1

    Hi,
    I'm creating an app using QTabWidget object, and for customizing it, I'm using a CSS file.
    The problem is that I can change the background of all my Tab Bars but i can not customize each one of theme ( for example changing the background image of each one of theme ).
    This is my CSS code for customizing all the tabs:
    QTabBar::tab {
    background-repeat: no-repeat;
    background-position: center;
    width: 127px;
    border-right: 1px solid white;
    padding-top: 88px;
    padding-bottom: 18px;
    color: white;
    font-style: bold;
    }

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

      Hi, welcome to devnet.

      With qss you can only style arbitrary tabs like :first, :last, :middle, :only-one etc. Unfortunately there's no way to style specific tab, e.g. :nth(42). To get to individual tabs you would have to do it from code.

      E 1 Reply Last reply
      1
      • Chris KawaC Chris Kawa

        Hi, welcome to devnet.

        With qss you can only style arbitrary tabs like :first, :last, :middle, :only-one etc. Unfortunately there's no way to style specific tab, e.g. :nth(42). To get to individual tabs you would have to do it from code.

        E Offline
        E Offline
        el yousfi
        wrote on last edited by
        #3

        @Chris-Kawa ok, Thanks man for your reply I really appreciate it :)

        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