void TabWidget::saveData(DataFileParser *file) { file->writeVal(m_id); if(m_tab_ids.empty()) { file->writeVal((quint32)0); return; } file->writeVal(count()); for(int i = 0; i < count(); ++i) { Tab *tab = (Tab*)widget(i); if(tab->isWorkTab()) { file->writeBlockIdentifier("tabWidgetTab"); QString name = tabToolTip(i); int idx = name.lastIndexOf(" - "); if(idx != -1) name = name.left(idx); file->writeString(name); ((WorkTab*)tab)->saveData(file); } } file->writeBlockIdentifier("tabWidgetIdx"); file->writeVal(currentIndex()); }
int TabWidget::pullTab(int index, TabWidget *origin) { QString name = origin->tabText(index); Tab *tab = (Tab*)origin->unregisterTab(index); int idx = addTab(tab, name, tab->isWorkTab() ? ((WorkTab*)tab)->getId() : ((ChildTab*)tab)->getId()); origin->checkEmpty(); tab->setWindowId(tabView()->getWindowId()); return idx; }