Unsolved QTabWidget
-
hello
I want to ask
How do i close the previous tab , the moment i add new one ?? -
@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. -
Hi
If you mean to remove the Tab from the TabWidget, you can use
http://doc.qt.io/qt-5/qtabwidget.html#removeTabHowever, 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. -
@mrjj
http://doc.qt.io/qt-5/qtabwidget.html#detailsMost of the functionality in
QTabWidget
is provided by aQTabBar
(at the top, providing the tabs) and aQStackedWidget
(most of the area, organizing the individual pages).So how do you mean that a
QStackedWidget
is a better fit than aQTabWidget
, if it's already composed of one? -
@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.
-
@SGaist
I don't quite get it, but maybe I never will. If you have a bunch of "pages" in aQStackedWidget
, and you want to use a tab like in aQTabBar
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 aQStackedWidget
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! -
@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.