From 1a583682e8a49e65d5c478ab72dffb78d120c850 Mon Sep 17 00:00:00 2001 From: llornkcor Date: Sun, 20 Oct 2002 15:49:18 +0000 Subject: added setCurrentTab and getCurrentTab using id for compatibilty --- (limited to 'libopie/otabwidget.cpp') diff --git a/libopie/otabwidget.cpp b/libopie/otabwidget.cpp index aaf14ce..bed7ef1 100644 --- a/libopie/otabwidget.cpp +++ b/libopie/otabwidget.cpp @@ -141,7 +141,7 @@ void OTabWidget::addTab( QWidget *child, const QString &icon, const QString &lab void OTabWidget::removePage( QWidget *childwidget ) { - if ( childwidget ) + if ( childwidget ) { OTabInfo *tab = tabs.first(); while ( tab && tab->control() != childwidget ) @@ -201,6 +201,19 @@ void OTabWidget::setCurrentTab( const QString &tabname ) } } +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; @@ -305,3 +318,12 @@ void OTabWidget::resizeEvent( QResizeEvent * ) { setUpLayout(); } + +int OTabWidget::getCurrentTab() { + if ( currentTab ) + { + return currentTab->id(); + } + return -1; +} + -- cgit v0.9.0.2