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. Customizing Qt Tab Widget
Forum Updated to NodeBB v4.3 + New Features

Customizing Qt Tab Widget

Scheduled Pinned Locked Moved Unsolved General and Desktop
18 Posts 2 Posters 5.9k 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.
  • FarhanF Farhan

    Hello everyone. I am new to Qt and currently playing with Qt Tab widget. I was just wondering if could customize tabs so that the background color of the tab name(where we click to switch tabs) is different from the background color of the rest of the tab(inner space of the tab). Currently when i set some background color in the style sheet of the tab, it assigns the same color to the whole tab widget. I want the tab like a toolbar where the background of the toolbar(usually white) can be different from the rest of the window. How can I do that?
    Any help would be really appreciated.

    RatzzR Offline
    RatzzR Offline
    Ratzz
    wrote on last edited by
    #2

    @Farhan
    If I understand you correctly is this what you wanted?

    --Alles ist gut.

    FarhanF 1 Reply Last reply
    1
    • RatzzR Ratzz

      @Farhan
      If I understand you correctly is this what you wanted?

      FarhanF Offline
      FarhanF Offline
      Farhan
      wrote on last edited by
      #3

      Exactly! how did you do that?

      RatzzR 1 Reply Last reply
      0
      • FarhanF Farhan

        Exactly! how did you do that?

        RatzzR Offline
        RatzzR Offline
        Ratzz
        wrote on last edited by
        #4

        @Farhan
        I just used setStyleSheet on QTabWidget .

        --Alles ist gut.

        FarhanF 1 Reply Last reply
        0
        • RatzzR Ratzz

          @Farhan
          I just used setStyleSheet on QTabWidget .

          FarhanF Offline
          FarhanF Offline
          Farhan
          wrote on last edited by
          #5

          what properties did you set in style sheet? can you show the style sheet?

          RatzzR 1 Reply Last reply
          0
          • FarhanF Farhan

            what properties did you set in style sheet? can you show the style sheet?

            RatzzR Offline
            RatzzR Offline
            Ratzz
            wrote on last edited by
            #6

            @Farhan

                    ui->tabWidget->setStyleSheet("background-color: red");

            --Alles ist gut.

            FarhanF 1 Reply Last reply
            1
            • RatzzR Ratzz

              @Farhan

                      ui->tabWidget->setStyleSheet("background-color: red");
              FarhanF Offline
              FarhanF Offline
              Farhan
              wrote on last edited by
              #7

              Actually i was using the same style sheet. after using the style sheet my window looked like this . But when I preview it it looks like this . my stylesheet is same as yours except the color ofcourse.

              RatzzR 1 Reply Last reply
              0
              • FarhanF Farhan

                Actually i was using the same style sheet. after using the style sheet my window looked like this . But when I preview it it looks like this . my stylesheet is same as yours except the color ofcourse.

                RatzzR Offline
                RatzzR Offline
                Ratzz
                wrote on last edited by
                #8

                @Farhan
                So you want the preview window to display same as the StyleSheet window?

                --Alles ist gut.

                FarhanF 1 Reply Last reply
                0
                • RatzzR Ratzz

                  @Farhan
                  So you want the preview window to display same as the StyleSheet window?

                  FarhanF Offline
                  FarhanF Offline
                  Farhan
                  wrote on last edited by
                  #9

                  yes I want to get my final window like this

                  RatzzR 1 Reply Last reply
                  0
                  • FarhanF Farhan

                    yes I want to get my final window like this

                    RatzzR Offline
                    RatzzR Offline
                    Ratzz
                    wrote on last edited by Ratzz
                    #10

                    @Farhan
                    Now how is your final window? so you already have? or what is the problem now?

                    --Alles ist gut.

                    FarhanF 1 Reply Last reply
                    0
                    • RatzzR Ratzz

                      @Farhan
                      Now how is your final window? so you already have? or what is the problem now?

                      FarhanF Offline
                      FarhanF Offline
                      Farhan
                      wrote on last edited by
                      #11

                      I am getting my final window like this . Here you can see the white color that apeared around the tab icons(blue colored icons) in designer_mode is gone. This is my problem. I want white color around my blue icons.

                      RatzzR 1 Reply Last reply
                      0
                      • FarhanF Farhan

                        I am getting my final window like this . Here you can see the white color that apeared around the tab icons(blue colored icons) in designer_mode is gone. This is my problem. I want white color around my blue icons.

                        RatzzR Offline
                        RatzzR Offline
                        Ratzz
                        wrote on last edited by
                        #12

                        @Farhan
                        But this is in preview mode does it the same when you run your application?

                        --Alles ist gut.

                        FarhanF 1 Reply Last reply
                        0
                        • RatzzR Ratzz

                          @Farhan
                          But this is in preview mode does it the same when you run your application?

                          FarhanF Offline
                          FarhanF Offline
                          Farhan
                          wrote on last edited by
                          #13

                          Oh God! i thought preview would be same as the application. Application is showing the desired result. Problem solved. Thank you very much.

                          FarhanF 1 Reply Last reply
                          0
                          • FarhanF Farhan

                            Oh God! i thought preview would be same as the application. Application is showing the desired result. Problem solved. Thank you very much.

                            FarhanF Offline
                            FarhanF Offline
                            Farhan
                            wrote on last edited by
                            #14

                            Just one more thing. Is it possible to create something like this using tab widget?

                            RatzzR 1 Reply Last reply
                            0
                            • FarhanF Farhan

                              Just one more thing. Is it possible to create something like this using tab widget?

                              RatzzR Offline
                              RatzzR Offline
                              Ratzz
                              wrote on last edited by
                              #15

                              @Farhan
                              But this already has ? Gray and white?

                              --Alles ist gut.

                              FarhanF 1 Reply Last reply
                              0
                              • RatzzR Ratzz

                                @Farhan
                                But this already has ? Gray and white?

                                FarhanF Offline
                                FarhanF Offline
                                Farhan
                                wrote on last edited by
                                #16

                                @Ratzz I mean the dark gray color.

                                RatzzR 1 Reply Last reply
                                0
                                • FarhanF Farhan

                                  @Ratzz I mean the dark gray color.

                                  RatzzR Offline
                                  RatzzR Offline
                                  Ratzz
                                  wrote on last edited by
                                  #17

                                  @Farhan
                                  I think you can set using http://doc.qt.io/qt-4.8/qtabwidget.html#tabBar

                                  --Alles ist gut.

                                  FarhanF 1 Reply Last reply
                                  1
                                  • RatzzR Ratzz

                                    @Farhan
                                    I think you can set using http://doc.qt.io/qt-4.8/qtabwidget.html#tabBar

                                    FarhanF Offline
                                    FarhanF Offline
                                    Farhan
                                    wrote on last edited by
                                    #18

                                    @Ratzz Thank you that was really helpful.

                                    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