Changing qt5 tab names dynamically

224 Views Asked by At

Say I have a tabwidget in my ui file this is how im adding tabs right now:

QPlainTextEdit *tab = new QPlaintextEdit;
int index = ui->tabWidget->addTab(tab, "changeme");

Now I'm wondering if it's possible to change the name of the tab on the go, for example when subclassing QPLainTextEdit in a class and connecting a signal to it when the text changes then i'd like to add a little star to the tab to indicate that the file has been modified, is it even possible?

1

There are 1 best solutions below

0
On BEST ANSWER

QTabWidet::setTabText does what you want.

E.g:

ui->tabWidget->setTabText(index, "new text");