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 change the color of the border of a QTabWidget?
Forum Updated to NodeBB v4.3 + New Features

How to change the color of the border of a QTabWidget?

Scheduled Pinned Locked Moved Unsolved Qt for Python
5 Posts 2 Posters 1.5k 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.
  • I Offline
    I Offline
    Igor86
    wrote on last edited by
    #1

    Hi all!

    I managed with your help to change the entirety of the QTabWidget how I like it, but there still is this white border that I cannot figure out how to get rid of... any help is greatly appreciated.

    152b6c3a-1f62-4254-bb05-913ec9af0097-image.png

    Thank you

    Best regards

    jsulmJ 1 Reply Last reply
    0
    • I Igor86

      Hi all!

      I managed with your help to change the entirety of the QTabWidget how I like it, but there still is this white border that I cannot figure out how to get rid of... any help is greatly appreciated.

      152b6c3a-1f62-4254-bb05-913ec9af0097-image.png

      Thank you

      Best regards

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Igor86 See https://doc.qt.io/qt-6/stylesheet-examples.html

      QTabBar::tab {
          background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
                                      stop: 0 #E1E1E1, stop: 0.4 #DDDDDD,
                                      stop: 0.5 #D8D8D8, stop: 1.0 #D3D3D3);
          border: 2px solid #C4C4C3;
          border-bottom-color: #C2C7CB; /* same as the pane color */
          border-top-left-radius: 4px;
          border-top-right-radius: 4px;
          min-width: 8ex;
          padding: 2px;
      }
      

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • I Offline
        I Offline
        Igor86
        wrote on last edited by
        #3

        @jsulm thank you for your answer. unfortunately I am not able to get it to work. the code you posted is changing the border of the tabs itself (the small tabs on top) but not the border fo the big tab (white in the screenshot above..)

        I used your code to temporarly put the border to black to display the result:

        038c6d31-5785-4b84-ba6b-83044f5a93b6-image.png

        jsulmJ 1 Reply Last reply
        0
        • I Igor86

          @jsulm thank you for your answer. unfortunately I am not able to get it to work. the code you posted is changing the border of the tabs itself (the small tabs on top) but not the border fo the big tab (white in the screenshot above..)

          I used your code to temporarly put the border to black to display the result:

          038c6d31-5785-4b84-ba6b-83044f5a93b6-image.png

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Igor86 Well, there are many other examples - did you check those?
          Maybe:

          QTabWidget::pane { /* The tab widget frame */
              border-top: 2px solid #C2C7CB;
              position: absolute;
              top: -0.5em;
          }
          

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          1
          • I Offline
            I Offline
            Igor86
            wrote on last edited by
            #5

            @jsulm said in How to change the color of the border of a QTabWidget?:

            QTabWidget::pane { /* The tab widget frame */
            border-top: 2px solid #C2C7CB;
            position: absolute;
            top: -0.5em;
            }

            Thank you very much!
            that worked

            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