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. QTabWidget
Qt 6.11 is out! See what's new in the release blog

QTabWidget

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 4 Posters 1.0k 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.
  • J Offline
    J Offline
    Jason S. Stevenson
    wrote on last edited by
    #1

    hello
    I want to ask
    How do i close the previous tab , the moment i add new one ??

    JonBJ 1 Reply Last reply
    0
    • J Jason S. Stevenson

      hello
      I want to ask
      How do i close the previous tab , the moment i add new one ??

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

      @Jason-S.-Stevenson
      What do you mean by "close"? You don't "close" the tabs on the bar or the page widgets, you just click between them.

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

        Hi
        If you mean to remove the Tab from the TabWidget, you can use
        http://doc.qt.io/qt-5/qtabwidget.html#removeTab

        However, if you are in need of some sort of Show one "page" of many and flip between them, then
        http://doc.qt.io/qt-5/qstackedwidget.html
        is a much better fit that TabWidget.

        JonBJ 1 Reply Last reply
        1
        • mrjjM mrjj

          Hi
          If you mean to remove the Tab from the TabWidget, you can use
          http://doc.qt.io/qt-5/qtabwidget.html#removeTab

          However, if you are in need of some sort of Show one "page" of many and flip between them, then
          http://doc.qt.io/qt-5/qstackedwidget.html
          is a much better fit that TabWidget.

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

          @mrjj
          http://doc.qt.io/qt-5/qtabwidget.html#details

          Most of the functionality in QTabWidget is provided by a QTabBar (at the top, providing the tabs) and a QStackedWidget (most of the area, organizing the individual pages).

          So how do you mean that a QStackedWidget is a better fit than a QTabWidget, if it's already composed of one?

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @JonB Because if the OP always want's to delete the previous tab before opening a new one, there's not much sense to have tabs at all.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            JonBJ 1 Reply Last reply
            2
            • SGaistS SGaist

              @JonB Because if the OP always want's to delete the previous tab before opening a new one, there's not much sense to have tabs at all.

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

              @SGaist
              I don't quite get it, but maybe I never will. If you have a bunch of "pages" in a QStackedWidget, and you want to use a tab like in a QTabBar to select which one to show, why would you want to "delete the previous tab [on the tabbar]"? And if you don't have a bunch of pages, why would you then want a QStackedWidget at all? If it's not a one-word answer I may not get it, so don't worry if it's too hard to explain!

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @JonB said in QTabWidget:

                @SGaist
                I don't quite get it, but maybe I never will. If you have a bunch of "pages" in a QStackedWidget, and you want to use a tab like in a QTabBar to select which one to show, why would you want to "delete the previous tab [on the tabbar]"?

                Good question that is left to the OP to answer as I don't know what he wants to do.

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                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