summaryrefslogtreecommitdiff
path: root/libopie/otabwidget.cpp
Side-by-side diff
Diffstat (limited to 'libopie/otabwidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r--libopie/otabwidget.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/libopie/otabwidget.cpp b/libopie/otabwidget.cpp
index fe2c60f..1b8c085 100644
--- a/libopie/otabwidget.cpp
+++ b/libopie/otabwidget.cpp
@@ -315,96 +315,105 @@ void OTabWidget::slotTabBarSelected( int id )
}
}
void OTabWidget::slotTabListSelected( int index )
{
OTabInfo *newtab = tabs.at( index );
if ( newtab )
{
selectTab( newtab );
}
}
QPixmap OTabWidget::loadSmooth( const QString &name )
{
QImage image = Resource::loadImage( name );
QPixmap pixmap;
pixmap.convertFromImage( image.smoothScale( 14, 14 ) );
return pixmap;
}
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();
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;
+}