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. Change the size of the Tab Widget icon
Qt 6.11 is out! See what's new in the release blog

Change the size of the Tab Widget icon

Scheduled Pinned Locked Moved Solved General and Desktop
9 Posts 2 Posters 2.6k 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.
  • R Offline
    R Offline
    Raphawel
    wrote on last edited by
    #1

    It is possible to change the icon size of a Tab Widget.

    6ad1bbc2-3c83-4cb5-8b01-a1473423c1ef-image.png

    I don't think you need the code to answer me. But if ever I will give it to you.

    Thanks for your help

    JonBJ 1 Reply Last reply
    0
    • R Raphawel

      It is possible to change the icon size of a Tab Widget.

      6ad1bbc2-3c83-4cb5-8b01-a1473423c1ef-image.png

      I don't think you need the code to answer me. But if ever I will give it to you.

      Thanks for your help

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #2

      @Raphawel
      A QTabWidget has a QTabBar where those tabs/text are placed. That is what you need to affect. Example using stylesheet:

      // tabWidget is a pointer to a QTabWidget
      tabWidget->setStyleSheet("QTabBar::tab { height: 100px; width: 100px; }");
      // each tab should now be 100x100px
      

      Though you ask about "icon size", but show no icons.... There is also QTabWidget::setIconSize(const QSize &size).

      R JonBJ 2 Replies Last reply
      3
      • JonBJ JonB

        @Raphawel
        A QTabWidget has a QTabBar where those tabs/text are placed. That is what you need to affect. Example using stylesheet:

        // tabWidget is a pointer to a QTabWidget
        tabWidget->setStyleSheet("QTabBar::tab { height: 100px; width: 100px; }");
        // each tab should now be 100x100px
        

        Though you ask about "icon size", but show no icons.... There is also QTabWidget::setIconSize(const QSize &size).

        R Offline
        R Offline
        Raphawel
        wrote on last edited by
        #3

        @JonB said in Change the size of the Tab Widget icon:

        QTabBar::tab { height: 100px; width: 100px; }");

        The order you tell me to make does not change anything. So I don't know if I'm writing it down correctly.
        In my case if I want to change the size of the "Control" icon, it is declared as "control_tab" in my QWidget.

        So according to what I wrote I put:

        ui->control_tab->setStyleSheet("QTabBar::control_tab { height: 100px; widht: 100px; }");
        
        JonBJ 1 Reply Last reply
        0
        • R Raphawel

          @JonB said in Change the size of the Tab Widget icon:

          QTabBar::tab { height: 100px; width: 100px; }");

          The order you tell me to make does not change anything. So I don't know if I'm writing it down correctly.
          In my case if I want to change the size of the "Control" icon, it is declared as "control_tab" in my QWidget.

          So according to what I wrote I put:

          ui->control_tab->setStyleSheet("QTabBar::control_tab { height: 100px; widht: 100px; }");
          
          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by
          #4

          @Raphawel
          Why don't you start by clarifying why you are asking about an icon size, given that you don't show any icons, while there is a QTabWidget::setIconSize() method. And you quote the line which sets the tab size, no reference to icon. We are not mind-readers, so don't know what you actually want to affect.

          the size of the "Control" icon, it is declared as "control_tab" in my QWidget

          What "Control" icon??

          QTabBar::control_tab { .... This is simply wrong. You can only write ::tab there.

          R 1 Reply Last reply
          0
          • JonBJ JonB

            @Raphawel
            Why don't you start by clarifying why you are asking about an icon size, given that you don't show any icons, while there is a QTabWidget::setIconSize() method. And you quote the line which sets the tab size, no reference to icon. We are not mind-readers, so don't know what you actually want to affect.

            the size of the "Control" icon, it is declared as "control_tab" in my QWidget

            What "Control" icon??

            QTabBar::control_tab { .... This is simply wrong. You can only write ::tab there.

            R Offline
            R Offline
            Raphawel
            wrote on last edited by
            #5

            @JonB

            49c7f5fb-87eb-4fe5-b867-3c51d08bf306-image.png

            Look at the pictures, I want the Control icon that I circled in red to take up less space. I have already tried to change the iconsize, in the settings but nothing changes

            When I run the .exe the Control tab that I circled in red again takes up space. I want to reduce this size just for aesthetics, that's all.
            7e9d94b8-07a1-4edb-a0c2-d14395d9ed9a-image.png

            I can't do more simple to explain my problem, sorry.

            So I need QTabWidget::setIconSize but why when I change the size of the Control tab in the settings nothing changes?

            JonBJ R 2 Replies Last reply
            0
            • R Raphawel

              @JonB

              49c7f5fb-87eb-4fe5-b867-3c51d08bf306-image.png

              Look at the pictures, I want the Control icon that I circled in red to take up less space. I have already tried to change the iconsize, in the settings but nothing changes

              When I run the .exe the Control tab that I circled in red again takes up space. I want to reduce this size just for aesthetics, that's all.
              7e9d94b8-07a1-4edb-a0c2-d14395d9ed9a-image.png

              I can't do more simple to explain my problem, sorry.

              So I need QTabWidget::setIconSize but why when I change the size of the Control tab in the settings nothing changes?

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by JonB
              #6

              @Raphawel said in Change the size of the Tab Widget icon:

              I can't do more simple to explain my problem, sorry.

              Look at the pictures, I want the Control icon that I circled in red

              I see no icon, neither on the Control tab nor elsewhere. What is circled in red is not an icon.
              I leave someone else to try to understand what you are asking.

              1 Reply Last reply
              0
              • R Raphawel

                @JonB

                49c7f5fb-87eb-4fe5-b867-3c51d08bf306-image.png

                Look at the pictures, I want the Control icon that I circled in red to take up less space. I have already tried to change the iconsize, in the settings but nothing changes

                When I run the .exe the Control tab that I circled in red again takes up space. I want to reduce this size just for aesthetics, that's all.
                7e9d94b8-07a1-4edb-a0c2-d14395d9ed9a-image.png

                I can't do more simple to explain my problem, sorry.

                So I need QTabWidget::setIconSize but why when I change the size of the Control tab in the settings nothing changes?

                R Offline
                R Offline
                Raphawel
                wrote on last edited by Raphawel
                #7

                @Raphawel I rectify not icon but tab, so change the size of the tab

                1 Reply Last reply
                0
                • JonBJ JonB

                  @Raphawel
                  A QTabWidget has a QTabBar where those tabs/text are placed. That is what you need to affect. Example using stylesheet:

                  // tabWidget is a pointer to a QTabWidget
                  tabWidget->setStyleSheet("QTabBar::tab { height: 100px; width: 100px; }");
                  // each tab should now be 100x100px
                  

                  Though you ask about "icon size", but show no icons.... There is also QTabWidget::setIconSize(const QSize &size).

                  JonBJ Offline
                  JonBJ Offline
                  JonB
                  wrote on last edited by JonB
                  #8

                  @Raphawel
                  Previously answered:
                  @JonB said in Change the size of the Tab Widget icon:

                  // tabWidget is a pointer to a QTabWidget
                  tabWidget->setStyleSheet("QTabBar::tab { height: 100px; width: 100px; }");
                  // each tab should now be 100x100px

                  R 1 Reply Last reply
                  0
                  • JonBJ JonB

                    @Raphawel
                    Previously answered:
                    @JonB said in Change the size of the Tab Widget icon:

                    // tabWidget is a pointer to a QTabWidget
                    tabWidget->setStyleSheet("QTabBar::tab { height: 100px; width: 100px; }");
                    // each tab should now be 100x100px

                    R Offline
                    R Offline
                    Raphawel
                    wrote on last edited by
                    #9

                    @JonB

                    Ok it works well, I didn't understand that tabWidget was applied to all the tabs of the GUI.
                    Thanks for help

                    1 Reply Last reply
                    0
                    • R Raphawel has marked this topic as solved on

                    • Login

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