PDA

View Full Version : Obtaining the currentTabText property



wconstan
6th December 2009, 23:26
I have a QMap defined as


QMap<QString, QString> design;

and that (in part) am populating with the following:


foreach (QTabWidget *tab, ui->MainWidget->findChildren<QTabWidget*>()) {
design.insert(tab->objectName() + ".index", QString::number(tab->currentIndex()));
// design.insert(tab->objectName() + ".string", tab->currentWidget()->objectName());
}

The first line in the foreach loop saves the currentIndex of the corresponding tab as a QString value using a key formed by the tab's objectName + ".index". The purpose of the second line is to save the currentTabText property of the currently selected tab but I can't seem to find the appropriate property, i.e., tab->currentTabText() does not exist. The above is an attempt in lieu of this missing property.

Is there another route that I can use to access the currentTabText via the above?

Thanks!

tsp
7th December 2009, 06:02
Is this what you are looking for?

QString tabText = tab->tabText(tab->currentIndex());