-rw-r--r-- | libopie/otabwidget.cpp | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/libopie/otabwidget.cpp b/libopie/otabwidget.cpp index aaf14ce..bed7ef1 100644 --- a/libopie/otabwidget.cpp +++ b/libopie/otabwidget.cpp @@ -138,13 +138,13 @@ void OTabWidget::addTab( QWidget *child, const QString &icon, const QString &lab tabs.append( tabinfo ); selectTab( tabinfo ); } void OTabWidget::removePage( QWidget *childwidget ) { - if ( childwidget ) + if ( childwidget ) { OTabInfo *tab = tabs.first(); while ( tab && tab->control() != childwidget ) { tab = tabs.next(); } @@ -198,12 +198,25 @@ void OTabWidget::setCurrentTab( const QString &tabname ) if ( newtab && newtab->label() == tabname ) { selectTab( newtab ); } } +void OTabWidget::setCurrentTab(int tabindex) { + OTabInfo *newtab = tabs.first(); + while ( newtab && newtab->id() != tabindex ) + { + newtab = tabs.next(); + } + if ( newtab && newtab->id() == tabindex ) + { + selectTab( newtab ); + } +} + + OTabWidget::TabStyle OTabWidget::tabStyle() const { return tabBarStyle; } void OTabWidget::setTabStyle( TabStyle s ) @@ -302,6 +315,15 @@ QSize OTabWidget::sizeHint() const } void OTabWidget::resizeEvent( QResizeEvent * ) { setUpLayout(); } + +int OTabWidget::getCurrentTab() { + if ( currentTab ) + { + return currentTab->id(); + } + return -1; +} + |