Topic was automatically imported from the old Question2Answer platform.
Asked By
Mrpaolosarino
Tab container is almost perfect but there is a flaw. You can’t customize the name of the tab in real-time.
Does anyone know how to customize the tab’s name real-time?
What do you mean? The name of the tab changes to match the name of the child node.
You can use tab_selected(int tab) signal from each tab and trigger a one shot timer whenever a click event is received. If a click occurred while the timer is active (double click), popup a dialog that contains a LineEdit, confirmation button and a cancel button. when the user confirms, use set_tab_title() to edit the title.
Make sure you pass up the tab number from tab_selected(int tab) so that you know which tab to change its title.
I needed to change the tab names to their translated strings. The string displayed to the user in the ui is just the name of the node.
As Clemens mentioned, you can change the tab title if you know the index of the tab (this sets the name of the node) but you can also attach a script directly to the tab which is how I solved my translation problem.
The script below saves the initial name of the tab in the onready var translationName, and then sets it to the translated string on ready and also when the ReTranslate signal is emitted.