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. Hiding the TabWidget
Forum Updated to NodeBB v4.3 + New Features

Hiding the TabWidget

Scheduled Pinned Locked Moved Unsolved General and Desktop
24 Posts 4 Posters 8.0k Views 1 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.
  • mrjjM Offline
    mrjjM Offline
    mrjj
    Lifetime Qt Champion
    wrote on last edited by
    #13

    Hi
    What is not working ?
    How does your current code look ?

    A 1 Reply Last reply
    0
    • mrjjM mrjj

      Hi
      What is not working ?
      How does your current code look ?

      A Offline
      A Offline
      amarism
      wrote on last edited by amarism
      #14

      @mrjj 0_1526884364537_TTTTTT.png

      I want to hide and show tab 1 and tab 2 by clicking on tab1 and tab 2. But when I used ur code they adding the extra tab on another side.

      1 Reply Last reply
      0
      • mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by mrjj
        #15

        Hi
        So you have 2 tabwidgets?
        Since its impossible to click on hidden tab as its not there. so you could never unhide it again with clicking.

        So when user click on tab 1 on tabWidget1, you want tab 1 to be shown on tabwidget 2?

        else i dont get what you are trying as the tab will be COMPLETELY gone if u "hide" it and hence you cannot click on it again
        so some other means of showing it is needed.

        Or did you just use @J-Hilk code as it is and got a second widget as it does
        QTabWidget *tWidget = new QTabWidget(this);
        ??
        If you are using that code with UI then
        QTabWidget *tWidget = ui->yourtabwidget as else you will create a second one.

        A 1 Reply Last reply
        0
        • mrjjM mrjj

          Hi
          So you have 2 tabwidgets?
          Since its impossible to click on hidden tab as its not there. so you could never unhide it again with clicking.

          So when user click on tab 1 on tabWidget1, you want tab 1 to be shown on tabwidget 2?

          else i dont get what you are trying as the tab will be COMPLETELY gone if u "hide" it and hence you cannot click on it again
          so some other means of showing it is needed.

          Or did you just use @J-Hilk code as it is and got a second widget as it does
          QTabWidget *tWidget = new QTabWidget(this);
          ??
          If you are using that code with UI then
          QTabWidget *tWidget = ui->yourtabwidget as else you will create a second one.

          A Offline
          A Offline
          amarism
          wrote on last edited by amarism
          #16

          @mrjj hide means the content of the tab hides not tab1 & tab2 hide just like a visual studio. ie I will be uploaded in the previously. Just see the example

          mrjjM 1 Reply Last reply
          0
          • A amarism

            @mrjj hide means the content of the tab hides not tab1 & tab2 hide just like a visual studio. ie I will be uploaded in the previously. Just see the example

            mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by mrjj
            #17

            @amarism
            so you want to hide what INSIDE the tab and not the actual tab?

            I dont know how Visual studio tabs works.
            But in Qt the tab is the whole white area and it will always show regardless of what you put inside.

            But if you just want to hide the content of the tab, why you ask how to remove / insert tabs.
            It sounds like u just want to hide ListWidget or what you have inside and not the "Tab 1"

            A 1 Reply Last reply
            0
            • mrjjM mrjj

              @amarism
              so you want to hide what INSIDE the tab and not the actual tab?

              I dont know how Visual studio tabs works.
              But in Qt the tab is the whole white area and it will always show regardless of what you put inside.

              But if you just want to hide the content of the tab, why you ask how to remove / insert tabs.
              It sounds like u just want to hide ListWidget or what you have inside and not the "Tab 1"

              A Offline
              A Offline
              amarism
              wrote on last edited by
              #18

              @mrjj Now how to resolve this problem.

              mrjjM 1 Reply Last reply
              0
              • A amarism

                @mrjj Now how to resolve this problem.

                mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by
                #19

                @amarism

                Im still not sure what you are trying but if just to hide/show say ListWidget
                you can simply use
                ui->listwidget->show();
                and
                ui->listwidget->hide();

                A 1 Reply Last reply
                0
                • mrjjM mrjj

                  @amarism

                  Im still not sure what you are trying but if just to hide/show say ListWidget
                  you can simply use
                  ui->listwidget->show();
                  and
                  ui->listwidget->hide();

                  A Offline
                  A Offline
                  amarism
                  wrote on last edited by amarism
                  #20

                  @mrjj I will try this one but when Clicking the Tab then inside the also hide and next we can't show hiding tab

                  mrjjM 1 Reply Last reply
                  0
                  • A amarism

                    @mrjj I will try this one but when Clicking the Tab then inside the also hide and next we can't show hiding tab

                    mrjjM Offline
                    mrjjM Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on last edited by
                    #21

                    @amarism said in Hiding the TabWidget:

                    when hiding the Tab widget next we can't show hiding tab

                    Im not sure what that means. If you hide tabWidget, all tabs will be hidden.

                    A 1 Reply Last reply
                    0
                    • mrjjM mrjj

                      @amarism said in Hiding the TabWidget:

                      when hiding the Tab widget next we can't show hiding tab

                      Im not sure what that means. If you hide tabWidget, all tabs will be hidden.

                      A Offline
                      A Offline
                      amarism
                      wrote on last edited by amarism
                      #22

                      @mrjj I have 2 tab widget tab (tab1 and tab2), Initially, I want to show only the tab just like minimize format (closed inside the black box)0_1526970076231_twcolor.png
                      and when i will click on the Tab 1 it will show the whole content of the tab (maximize the tab content). just like below image0_1526970223564_TWcolor2.png
                      and again we click the same tab it will again minimize it(toggle).

                      1 Reply Last reply
                      0
                      • mrjjM Offline
                        mrjjM Offline
                        mrjj
                        Lifetime Qt Champion
                        wrote on last edited by
                        #23

                        Hi
                        Ah. i see.
                        The issues that the tabs lives inside the tabwidget.
                        so if you reduce the size of the tabwidget to appear "collapsed" then all must be collapsed
                        at same time. if thats ok, you can alter the width of the widget.

                        Alternatively, you could use
                        http://doc.qt.io/qt-5/qtabbar.html#details
                        which might work better for your use case.

                        A 1 Reply Last reply
                        0
                        • mrjjM mrjj

                          Hi
                          Ah. i see.
                          The issues that the tabs lives inside the tabwidget.
                          so if you reduce the size of the tabwidget to appear "collapsed" then all must be collapsed
                          at same time. if thats ok, you can alter the width of the widget.

                          Alternatively, you could use
                          http://doc.qt.io/qt-5/qtabbar.html#details
                          which might work better for your use case.

                          A Offline
                          A Offline
                          amarism
                          wrote on last edited by
                          #24

                          @mrjj Actually sir I am new in QT. So, I am not able to write code properly. If you have a similar type of code please share with me

                          1 Reply Last reply
                          -1

                          • Login

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