-rw-r--r-- | libopie/otabwidget.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/libopie/otabwidget.cpp b/libopie/otabwidget.cpp index aaf14ce..bed7ef1 100644 --- a/libopie/otabwidget.cpp +++ b/libopie/otabwidget.cpp @@ -196,16 +196,29 @@ void OTabWidget::setCurrentTab( const QString &tabname ) newtab = tabs.next(); } 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 ) { tabBarStyle = s; @@ -300,8 +313,17 @@ QSize OTabWidget::sizeHint() const QSize t( tabBarStack->sizeHint() ); return QSize( QMAX( s.width(), t.width()), s.height() + t.height() ); } void OTabWidget::resizeEvent( QResizeEvent * ) { setUpLayout(); } + +int OTabWidget::getCurrentTab() { + if ( currentTab ) + { + return currentTab->id(); + } + return -1; +} + |