[Solved] QTabWidget: how to detect a tab has been added (or removed)
-
Hi,
I sub-classed QTabWidget to hide the tab bar if there is only one tab (tabBar()->hide() and tabBar()->show() work well for that), but my problem is where to check tab count. According to the doc, there is no signal when a tab is added or removed, and when adding or removing a tab, the current selected tab may not change. Maybe by reimplementing an event (but which one)?
-
Hi,
You can re-implement the tabInsterted/tabRemoved functions
http://qt-project.org/doc/qt-4.8/qtabwidget.html#tabInserted
http://qt-project.org/doc/qt-4.8/qtabwidget.html#tabRemovedHope it helps
-
Hi,
think that the best way to do this is to create a signal in the dialog where you add new tabs and then create a slot in your tabWidget class that will issue a redraw (first remember the selected tab).
In the constructor of the dialog add a reference or a pointer to you tabWidget and connect the signal/slot.
Think this is straight forward and not real special.
Greetz