summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/otabwidget.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/libopie/otabwidget.cpp b/libopie/otabwidget.cpp
index 1f3fbb0..6ef4034 100644
--- a/libopie/otabwidget.cpp
+++ b/libopie/otabwidget.cpp
@@ -85,25 +85,25 @@ OTabWidget::OTabWidget( QWidget *parent, const char *name, TabStyle s, TabPositi
tabBarStack->raiseWidget( tabBar );
}
else if ( tabBarStyle == TextList || tabBarStyle == IconList )
{
tabBarStack->raiseWidget( tabList );
}
if ( tabBarPosition == Bottom )
{
tabBar->setShape( QTabBar::RoundedBelow );
}
- tabs.setAutoDelete( TRUE );
+ //tabs.setAutoDelete( TRUE );
currentTab= 0x0;
}
OTabWidget::~OTabWidget()
{
}
void OTabWidget::addTab( QWidget *child, const QString &icon, const QString &label )
{
QPixmap iconset = loadSmooth( icon );
QTab * tab = new QTab();
@@ -131,46 +131,48 @@ void OTabWidget::addTab( QWidget *child, const QString &icon, const QString &lab
}
widgetStack->addWidget( child, tabid );
widgetStack->raiseWidget( child );
OTabInfo *tabinfo = new OTabInfo( tabid, child, icon, label );
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();
}
if ( tab && tab->control() == childwidget )
{
tabBar->setTabEnabled( tab->id(), FALSE );
tabBar->removeTab( tabBar->tab( tab->id() ) );
int i = 0;
while ( i < tabList->count() && tabList->text( i ) != tab->label() )
{
i++;
}
if ( tabList->text( i ) == tab->label() )
{
tabList->removeItem( i );
}
widgetStack->removeWidget( childwidget );
tabs.remove( tab );
+ delete tab;
+ currentTab = tabs.current();
setUpLayout();
}
}
}
void OTabWidget::setCurrentTab( QWidget *childwidget )
{
OTabInfo *newtab = tabs.first();
while ( newtab && newtab->control() != childwidget )
{
newtab = tabs.next();
}
@@ -240,25 +242,25 @@ QPixmap OTabWidget::loadSmooth( const QString &name )
QImage image = Resource::loadImage( name );
QPixmap pixmap;
pixmap.convertFromImage( image.smoothScale( 16, 16 ) );
return pixmap;
}
void OTabWidget::selectTab( OTabInfo *tab )
{
if ( tabBarStyle == IconTab )
{
if ( currentTab )
{
- tabBar->tab( currentTab->id() )->setText( QString::null );
+ tabBar->tab( currentTab->id() )->setText( "" );
setUpLayout();
}
tabBar->tab( tab->id() )->setText( tab->label() );
currentTab = tab;
}
tabBar->setCurrentTab( tab->id() );
setUpLayout();
tabBar->update();
widgetStack->raiseWidget( tab->control() );
emit currentChanged( tab->control() );