Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How to get currentTabName from QTabWidget on Qt?
QTabWidgethas a property called
How can I access the
I need to check what tab is selected, but I can't use the tab text (
tabText) because it is translatable and may change and I don't want to use the tab index (
currentIndex) because the index may change in the future.
I'm using Qt 5.3
Where did you see that property ?
Why do you need to check which tab is selected and particularly why by its name ?
@SGaist, I found the property here:
I want to access the tab by a value that will be not changed in the future. The text and the index may be changed.
I have a button that calls a function that loads a new window based on the selected tab (this new window is used only to show some tips about the currently opened tab), so I need to check what tab is currently selected.
This is the object name of the current widget. From code you'd get it like this:
QString currentTabName = tabWidget->currentWidget()->objectName();
As the doc suggest make sure you check for
@Chris-Kawa thanks a lot. This is exactly what I was looking for.