void HierarchyList::removeTabPage() { QWidget *w = current(); if ( !w ) return; if ( w->inherits( "QTabWidget" ) ) { QTabWidget *tw = (QTabWidget*)w; if ( tw->currentPage() ) { QDesignerTabWidget *dtw = (QDesignerTabWidget*)tw; DeleteTabPageCommand *cmd = new DeleteTabPageCommand( i18n("Delete Page %1 of %2" ). arg( dtw->pageTitle() ).arg( tw->name() ), formWindow, tw, tw->currentPage() ); formWindow->commandHistory()->addCommand( cmd ); cmd->execute(); } } else if ( w->inherits( "QWizard" ) ) { QWizard *wiz = (QWizard*)formWindow->mainContainer(); if ( wiz->currentPage() ) { QDesignerWizard *dw = (QDesignerWizard*)wiz; DeleteWizardPageCommand *cmd = new DeleteWizardPageCommand( i18n("Delete Page %1 of %2" ). arg( dw->pageTitle() ).arg( wiz->name() ), formWindow, wiz, wiz->indexOf( wiz->currentPage() ), true ); formWindow->commandHistory()->addCommand( cmd ); cmd->execute(); } } }
void HierarchyList::addTabPage() { QWidget *w = current(); if ( !w ) return; if ( w->inherits( "QTabWidget" ) ) { QTabWidget *tw = (QTabWidget*)w; AddTabPageCommand *cmd = new AddTabPageCommand( i18n("Add Page to %1" ).arg( tw->name() ), formWindow, tw, "Tab" ); formWindow->commandHistory()->addCommand( cmd ); cmd->execute(); } else if ( w->inherits( "QWizard" ) ) { QWizard *wiz = (QWizard*)formWindow->mainContainer(); AddWizardPageCommand *cmd = new AddWizardPageCommand( i18n("Add Page to %1" ).arg( wiz->name() ), formWindow, wiz, "Page" ); formWindow->commandHistory()->addCommand( cmd ); cmd->execute(); } }