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
QtWS25 Last Chance

Customizing Qt Tab Widget

Scheduled Pinned Locked Moved Unsolved General and Desktop
18 Posts 2 Posters 5.4k 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.
  • F Offline
    F Offline
    Farhan
    wrote on 21 May 2016, 07:13 last edited by
    #1

    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.

    R 1 Reply Last reply 21 May 2016, 08:00
    0
    • F Farhan
      21 May 2016, 07:13

      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.

      R Offline
      R Offline
      Ratzz
      wrote on 21 May 2016, 08:00 last edited by
      #2

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

      --Alles ist gut.

      F 1 Reply Last reply 21 May 2016, 08:13
      1
      • R Ratzz
        21 May 2016, 08:00

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

        F Offline
        F Offline
        Farhan
        wrote on 21 May 2016, 08:13 last edited by
        #3

        Exactly! how did you do that?

        R 1 Reply Last reply 21 May 2016, 08:16
        0
        • F Farhan
          21 May 2016, 08:13

          Exactly! how did you do that?

          R Offline
          R Offline
          Ratzz
          wrote on 21 May 2016, 08:16 last edited by
          #4

          @Farhan
          I just used setStyleSheet on QTabWidget .

          --Alles ist gut.

          F 1 Reply Last reply 21 May 2016, 08:19
          0
          • R Ratzz
            21 May 2016, 08:16

            @Farhan
            I just used setStyleSheet on QTabWidget .

            F Offline
            F Offline
            Farhan
            wrote on 21 May 2016, 08:19 last edited by
            #5

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

            R 1 Reply Last reply 21 May 2016, 08:22
            0
            • F Farhan
              21 May 2016, 08:19

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

              R Offline
              R Offline
              Ratzz
              wrote on 21 May 2016, 08:22 last edited by
              #6

              @Farhan

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

              --Alles ist gut.

              F 1 Reply Last reply 21 May 2016, 08:30
              1
              • R Ratzz
                21 May 2016, 08:22

                @Farhan

                        ui->tabWidget->setStyleSheet("background-color: red");
                F Offline
                F Offline
                Farhan
                wrote on 21 May 2016, 08:30 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.

                R 1 Reply Last reply 21 May 2016, 08:32
                0
                • F Farhan
                  21 May 2016, 08:30

                  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.

                  R Offline
                  R Offline
                  Ratzz
                  wrote on 21 May 2016, 08:32 last edited by
                  #8

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

                  --Alles ist gut.

                  F 1 Reply Last reply 21 May 2016, 08:35
                  0
                  • R Ratzz
                    21 May 2016, 08:32

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

                    F Offline
                    F Offline
                    Farhan
                    wrote on 21 May 2016, 08:35 last edited by
                    #9

                    yes I want to get my final window like this

                    R 1 Reply Last reply 21 May 2016, 08:36
                    0
                    • F Farhan
                      21 May 2016, 08:35

                      yes I want to get my final window like this

                      R Offline
                      R Offline
                      Ratzz
                      wrote on 21 May 2016, 08:36 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.

                      F 1 Reply Last reply 21 May 2016, 08:42
                      0
                      • R Ratzz
                        21 May 2016, 08:36

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

                        F Offline
                        F Offline
                        Farhan
                        wrote on 21 May 2016, 08:42 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.

                        R 1 Reply Last reply 21 May 2016, 08:46
                        0
                        • F Farhan
                          21 May 2016, 08:42

                          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.

                          R Offline
                          R Offline
                          Ratzz
                          wrote on 21 May 2016, 08:46 last edited by
                          #12

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

                          --Alles ist gut.

                          F 1 Reply Last reply 21 May 2016, 08:54
                          0
                          • R Ratzz
                            21 May 2016, 08:46

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

                            F Offline
                            F Offline
                            Farhan
                            wrote on 21 May 2016, 08:54 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.

                            F 1 Reply Last reply 21 May 2016, 09:00
                            0
                            • F Farhan
                              21 May 2016, 08:54

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

                              F Offline
                              F Offline
                              Farhan
                              wrote on 21 May 2016, 09:00 last edited by
                              #14

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

                              R 1 Reply Last reply 21 May 2016, 09:51
                              0
                              • F Farhan
                                21 May 2016, 09:00

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

                                R Offline
                                R Offline
                                Ratzz
                                wrote on 21 May 2016, 09:51 last edited by
                                #15

                                @Farhan
                                But this already has ? Gray and white?

                                --Alles ist gut.

                                F 1 Reply Last reply 21 May 2016, 10:11
                                0
                                • R Ratzz
                                  21 May 2016, 09:51

                                  @Farhan
                                  But this already has ? Gray and white?

                                  F Offline
                                  F Offline
                                  Farhan
                                  wrote on 21 May 2016, 10:11 last edited by
                                  #16

                                  @Ratzz I mean the dark gray color.

                                  R 1 Reply Last reply 21 May 2016, 10:24
                                  0
                                  • F Farhan
                                    21 May 2016, 10:11

                                    @Ratzz I mean the dark gray color.

                                    R Offline
                                    R Offline
                                    Ratzz
                                    wrote on 21 May 2016, 10:24 last edited by
                                    #17

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

                                    --Alles ist gut.

                                    F 1 Reply Last reply 21 May 2016, 10:29
                                    1
                                    • R Ratzz
                                      21 May 2016, 10:24

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

                                      F Offline
                                      F Offline
                                      Farhan
                                      wrote on 21 May 2016, 10:29 last edited by
                                      #18

                                      @Ratzz Thank you that was really helpful.

                                      1 Reply Last reply
                                      0

                                      4/18

                                      21 May 2016, 08:16

                                      topic:navigator.unread, 14
                                      • Login

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