-rw-r--r-- | libopie2/opieui/otabwidget.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libopie2/opieui/otabwidget.cpp b/libopie2/opieui/otabwidget.cpp index 80a4c9b..d23b1c9 100644 --- a/libopie2/opieui/otabwidget.cpp +++ b/libopie2/opieui/otabwidget.cpp @@ -257,170 +257,170 @@ void OTabWidget::setTabStyle( TabStyle s ) { currtab = tabBar->tab( tabinfo->id() ); if ( tabBarStyle == IconTab ) { currtab->iconset = new QIconSet( loadSmooth( tabinfo->icon() ) ); if ( tabinfo == currTab ) currtab->setText( tabinfo->label() ); else currtab->setText( QString::null ); } else { currtab->iconset = 0x0; currtab->setText( tabinfo->label() ); } } tabBarStack->raiseWidget( tabBar ); } else if ( tabBarStyle == TextList || tabBarStyle == IconList ) { tabList->clear(); for ( OTabInfo *tabinfo = tabs.first(); tabinfo; tabinfo = tabs.next() ) { if ( tabBarStyle == IconList ) { tabList->insertItem( loadSmooth( tabinfo->icon() ), tabinfo->label() ); } else { tabList->insertItem( tabinfo->label() ); } } tabBarStack->raiseWidget( tabList ); } setUpLayout(); } OTabWidget::TabPosition OTabWidget::tabPosition() const { return tabBarPosition; } void OTabWidget::setTabPosition( TabPosition p ) { tabBarPosition = p; if ( tabBarPosition == Top ) { tabBar->setShape( QTabBar::RoundedAbove ); } else { tabBar->setShape( QTabBar::RoundedBelow ); } setUpLayout(); } void OTabWidget::slotTabBarSelected( int id ) { OTabInfo *newtab = tabs.first(); while ( newtab && newtab->id() != id ) { newtab = tabs.next(); } if ( newtab && newtab->id() == id ) { selectTab( newtab ); } } void OTabWidget::slotTabListSelected( int index ) { OTabInfo *newtab = tabs.at( index ); if ( newtab ) { selectTab( newtab ); } } QPixmap OTabWidget::loadSmooth( const QString &name ) { QPixmap p; p.convertFromImage( Resource::loadImage( name ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); return p; } void OTabWidget::selectTab( OTabInfo *tab ) { if ( tabBarStyle == IconTab ) { if ( currTab ) { tabBar->tab( currTab->id() )->setText( QString::null ); setUpLayout(); } tabBar->tab( tab->id() )->setText( tab->label() ); tabBar->setCurrentTab( tab->id() ); -// setUpLayout(); + setUpLayout(); tabBar->update(); } else { tabBar->setCurrentTab( tab->id() ); } widgetStack->raiseWidget( tab->control() ); emit currentChanged( tab->control() ); currTab = tab; } void OTabWidget::setUpLayout() { tabBar->layoutTabs(); QSize t( tabBarStack->sizeHint() ); if ( tabBarStyle == IconTab ) { if ( t.width() > width() ) t.setWidth( width() ); } else { t.setWidth( width() ); } int lw = widgetStack->lineWidth(); if ( tabBarPosition == Bottom ) { tabBarStack->setGeometry( QMAX(0, lw-2), height() - t.height() - lw, t.width(), t.height() ); widgetStack->setGeometry( 0, 0, width(), height()-t.height()+QMAX(0, lw-2) ); } else { tabBarStack->setGeometry( QMAX(0, lw-2), 0, t.width(), t.height() ); widgetStack->setGeometry( 0, t.height()-lw, width(), height()-t.height()+QMAX( 0, lw-2 ) ); } if ( autoMask() ) updateMask(); } QSize OTabWidget::sizeHint() const { QSize s( widgetStack->sizeHint() ); QSize t( tabBarStack->sizeHint() ); return QSize( QMAX( s.width(), t.width() ), s.height() + t.height() ); } void OTabWidget::resizeEvent( QResizeEvent * ) { setUpLayout(); } int OTabWidget::currentTab() { if ( currTab ) { return currTab->id(); } return -1; } QWidget* OTabWidget::currentWidget()const { if ( currTab ) { return currTab->control(); } return 0; } |