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. How to hide a page of tabview?

How to hide a page of tabview?

Scheduled Pinned Locked Moved Solved General and Desktop
19 Posts 4 Posters 5.6k Views 2 Watching
  • 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.
  • MucipM Mucip

    Dear @VRonin,
    How???

    Regards,
    Mucip:)

    VRoninV Offline
    VRoninV Offline
    VRonin
    wrote on last edited by VRonin
    #10

    @Mucip said in How to hide a page of tabview?:

    How???

    if(ui->tabWidget->tabBar()->tabButton(0,QTabBar::LeftSide)==nullptr)
    qDebug("It's NULL!");
    

    "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
    ~Napoleon Bonaparte

    On a crusade to banish setIndexWidget() from the holy land of Qt

    MucipM 1 Reply Last reply
    0
    • VRoninV VRonin

      @Mucip said in How to hide a page of tabview?:

      How???

      if(ui->tabWidget->tabBar()->tabButton(0,QTabBar::LeftSide)==nullptr)
      qDebug("It's NULL!");
      
      MucipM Offline
      MucipM Offline
      Mucip
      wrote on last edited by
      #11

      Dear @VRonin ,
      Yes. It returns NULL... ?!

      Regards,
      Mucip:)

      1 Reply Last reply
      0
      • J.HilkJ Offline
        J.HilkJ Offline
        J.Hilk
        Moderators
        wrote on last edited by
        #12

        to quote Chris-Kawa from this thread 5 years ago:

        @Chris-Kawa said in [Solved] Hiding tab from QTabWidget made in QtCreator:

        There's no built in method like setTabVisible(false) unfortunately.
        The workaround I often use is applying this stylesheet:
        @
        QTabWidget::tab:disabled { width: 0; height: 0; margin: 0; padding: 0; border: none; }
        @
        and then using setTabEnabled(false).
        Of course if you also need disabled (grayed out) tabs this method won't work.


        Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


        Q: What's that?
        A: It's blue light.
        Q: What does it do?
        A: It turns blue.

        MucipM 1 Reply Last reply
        1
        • J.HilkJ J.Hilk

          to quote Chris-Kawa from this thread 5 years ago:

          @Chris-Kawa said in [Solved] Hiding tab from QTabWidget made in QtCreator:

          There's no built in method like setTabVisible(false) unfortunately.
          The workaround I often use is applying this stylesheet:
          @
          QTabWidget::tab:disabled { width: 0; height: 0; margin: 0; padding: 0; border: none; }
          @
          and then using setTabEnabled(false).
          Of course if you also need disabled (grayed out) tabs this method won't work.

          MucipM Offline
          MucipM Offline
          Mucip
          wrote on last edited by Mucip
          #13

          Dear @J.Hilk ,
          I have seen this before but ıt must be easier way I guess...
          I tryed styleshit but I do not know much about stylsheet?!...
          Regards,
          Mucip:)

          J.HilkJ 1 Reply Last reply
          0
          • MucipM Mucip

            Dear @J.Hilk ,
            I have seen this before but ıt must be easier way I guess...
            I tryed styleshit but I do not know much about stylsheet?!...
            Regards,
            Mucip:)

            J.HilkJ Offline
            J.HilkJ Offline
            J.Hilk
            Moderators
            wrote on last edited by J.Hilk
            #14

            @Mucip
            well it should be pretty simple and kind of self-explanatory

            tabWidget->setStyleSheet("QTabWidget::tab:disabled { width: 0; height: 0; margin: 0; padding: 0; border: none; }"); //This needs to be done once, preverably in your constructor or inside QtDesigner, should you use it
            
            //On hide Tab_0 clicked
            tabWidget->setTabEnabled(0, false);
            

            Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


            Q: What's that?
            A: It's blue light.
            Q: What does it do?
            A: It turns blue.

            MucipM 1 Reply Last reply
            1
            • J.HilkJ J.Hilk

              @Mucip
              well it should be pretty simple and kind of self-explanatory

              tabWidget->setStyleSheet("QTabWidget::tab:disabled { width: 0; height: 0; margin: 0; padding: 0; border: none; }"); //This needs to be done once, preverably in your constructor or inside QtDesigner, should you use it
              
              //On hide Tab_0 clicked
              tabWidget->setTabEnabled(0, false);
              
              MucipM Offline
              MucipM Offline
              Mucip
              wrote on last edited by
              #15

              Dear @J.Hilk ,
              Yes. It worked... :)
              But the tab label is still visible?!...

              Regards,
              Mucip:)

              J.HilkJ 1 Reply Last reply
              0
              • MucipM Mucip

                Dear @J.Hilk ,
                Yes. It worked... :)
                But the tab label is still visible?!...

                Regards,
                Mucip:)

                J.HilkJ Offline
                J.HilkJ Offline
                J.Hilk
                Moderators
                wrote on last edited by
                #16

                @Mucip
                I'm not sure what you mean exactly

                but you can take a look here:
                http://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qtabwidget-and-qtabbar

                what else you can do with the QTabWidget and QStyleSheet


                Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                Q: What's that?
                A: It's blue light.
                Q: What does it do?
                A: It turns blue.

                MucipM 1 Reply Last reply
                0
                • J.HilkJ J.Hilk

                  @Mucip
                  I'm not sure what you mean exactly

                  but you can take a look here:
                  http://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qtabwidget-and-qtabbar

                  what else you can do with the QTabWidget and QStyleSheet

                  MucipM Offline
                  MucipM Offline
                  Mucip
                  wrote on last edited by
                  #17

                  Dear @J.Hilk ,
                  You may check:
                  Before Hide status:
                  0_1523957969434_BeforeHide.PNG

                  After Hide Status:
                  0_1523957985802_AfterHide.PNG

                  Yes. It's disabeld but tab labels are still visible?!... :(

                  Regards,
                  Mucip:)

                  J.HilkJ 1 Reply Last reply
                  0
                  • MucipM Mucip

                    Dear @J.Hilk ,
                    You may check:
                    Before Hide status:
                    0_1523957969434_BeforeHide.PNG

                    After Hide Status:
                    0_1523957985802_AfterHide.PNG

                    Yes. It's disabeld but tab labels are still visible?!... :(

                    Regards,
                    Mucip:)

                    J.HilkJ Offline
                    J.HilkJ Offline
                    J.Hilk
                    Moderators
                    wrote on last edited by
                    #18

                    @Mucip
                    sry, 5 years i s a long time, stuff changes.

                    The stylesheet is supposed to be QTabBar not QTabWidget

                    tabWidget->setStyleSheet("QTabBar::tab:disabled { width: 0; height: 0; margin: 0; padding: 0; border: none; }");
                    

                    Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                    Q: What's that?
                    A: It's blue light.
                    Q: What does it do?
                    A: It turns blue.

                    MucipM 1 Reply Last reply
                    1
                    • J.HilkJ J.Hilk

                      @Mucip
                      sry, 5 years i s a long time, stuff changes.

                      The stylesheet is supposed to be QTabBar not QTabWidget

                      tabWidget->setStyleSheet("QTabBar::tab:disabled { width: 0; height: 0; margin: 0; padding: 0; border: none; }");
                      
                      MucipM Offline
                      MucipM Offline
                      Mucip
                      wrote on last edited by
                      #19

                      Dear @J.Hilk ,
                      Yes thanks. But something happening strange! I do not know why? Very little part of the picture (picture labels of first tab which is just hided!) remain back. Whan I click other tabs than it disappears... ?!
                      Strange?!...
                      0_1523962521694_hata.PNG

                      Regards,
                      Mucip:)

                      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