author | zecke <zecke> | 2002-10-11 22:32:31 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-10-11 22:32:31 (UTC) |
commit | ffa7f45a2100b7c438a437fce2d3a47608bd36e3 (patch) (side-by-side diff) | |
tree | ccfa8b0c7490d2a271ff7f5edc19ae8e14e277f1 /libopie | |
parent | c8c961b4106f49f544195733cef17af5f15f6bb8 (diff) | |
download | opie-ffa7f45a2100b7c438a437fce2d3a47608bd36e3.zip opie-ffa7f45a2100b7c438a437fce2d3a47608bd36e3.tar.gz opie-ffa7f45a2100b7c438a437fce2d3a47608bd36e3.tar.bz2 |
Fix from drw for his widget. This sounds a bit paradox
Remove Page and Inserting one again crashed...
This patch fixes this problem
-rw-r--r-- | libopie/otabwidget.cpp | 8 |
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 @@ -89,17 +89,17 @@ OTabWidget::OTabWidget( QWidget *parent, const char *name, TabStyle s, TabPositi 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 ) @@ -135,17 +135,17 @@ void OTabWidget::addTab( QWidget *child, const QString &icon, const QString &lab 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 ) { @@ -157,16 +157,18 @@ void OTabWidget::removePage( QWidget *childwidget ) 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(); @@ -244,17 +246,17 @@ QPixmap OTabWidget::loadSmooth( const QString &name ) } 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(); |