summaryrefslogtreecommitdiff
path: root/libopie/otabwidget.cpp
Side-by-side diff
Diffstat (limited to 'libopie/otabwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/otabwidget.cpp48
1 files changed, 42 insertions, 6 deletions
diff --git a/libopie/otabwidget.cpp b/libopie/otabwidget.cpp
index bee3f35..99bf067 100644
--- a/libopie/otabwidget.cpp
+++ b/libopie/otabwidget.cpp
@@ -99,5 +99,5 @@ void OTabWidget::addTab( QWidget *child, const QString &icon, const QString &lab
tab->label = label;
}
- if ( tabBarStyle == IconTab || tabBarStyle == IconList)
+ if ( tabBarStyle == IconTab || tabBarStyle == IconList )
{
tab->iconset = new QIconSet( iconset );
@@ -159,14 +159,50 @@ void OTabWidget::removePage( QWidget *childwidget )
}
+void OTabWidget::changeTab( QWidget *widget, const QString &iconset, const QString &label)
+{
+ OTabInfo *currtab = tabs.first();
+ while ( currtab && currtab->control() != widget )
+ {
+ currtab = tabs.next();
+ }
+ if ( currtab && currtab->control() == widget )
+ {
+ QTab *tab = tabBar->tab( currtab->id() );
+ QPixmap icon( loadSmooth( iconset ) );
+ tab->setText( label );
+ if ( tabBarStyle == IconTab )
+ tab->setIconSet( icon );
+ int i = 0;
+ while ( i < tabList->count() && tabList->text( i ) != currtab->label() )
+ {
+ i++;
+ }
+ if ( i < tabList->count() && tabList->text( i ) == currtab->label() )
+ {
+ if ( tabBarStyle == IconTab || tabBarStyle == IconList )
+ {
+ tabList->changeItem( icon, label, i );
+ }
+ else
+ {
+ tabList->changeItem( label, i );
+ }
+ }
+ currtab->setLabel( label );
+ currtab->setIcon( iconset );
+ }
+ setUpLayout();
+}
+
void OTabWidget::setCurrentTab( QWidget *childwidget )
{
- OTabInfo *newtab = tabs.first();
- while ( newtab && newtab->control() != childwidget )
+ OTabInfo *currtab = tabs.first();
+ while ( currtab && currtab->control() != childwidget )
{
- newtab = tabs.next();
+ currtab = tabs.next();
}
- if ( newtab && newtab->control() == childwidget )
+ if ( currtab && currtab->control() == childwidget )
{
- selectTab( newtab );
+ selectTab( currtab );
}
}