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. Custom two different QTabWidgets with stylesheet

Custom two different QTabWidgets with stylesheet

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 3 Posters 661 Views
  • 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.
  • ivanicyI Offline
    ivanicyI Offline
    ivanicy
    wrote on last edited by VRonin
    #1

    Hi, I'm trying to custom two differents QTabWidget but, I don't remember how to identificate the different elements of each, for example, the QTabBar element.

    I have something like this:

    QTabBar::tab {
    	height: 37px;
    	width: 40px;
    	color: rgb(255, 255, 255);
    	background-color: rgb(57, 66, 99);
            min-width: 8ex;
            padding: 3px;	
    	border-top: 1px solid gray;
    	border-bottom: 1px solid gray;
    }
    

    but, when I try to custom the second QTabWidget, it takes the stylesheet from the first. I think it works with the '#' character but I don't remember how.

    How could I do this?

    My QTabWidget names are mainTabWidget and tabWidget02.

    Thank you very much!!

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

      use objectName like #objectName { style sheet }

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

      1 Reply Last reply
      8
      • ivanicyI Offline
        ivanicyI Offline
        ivanicy
        wrote on last edited by
        #3

        Yes. This solution works but, in the interface I haven't got a QTabBar widget. I have two QTabWidgets and I want to know how can I differentiate their associate QTabBar.

        Thank you!

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi and welcome to devnet,

          Use the tab-bar sub-control for that.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          1

          • Login

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