summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/otabwidget.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/libopie/otabwidget.cpp b/libopie/otabwidget.cpp
index 5fc3e8e..1fee919 100644
--- a/libopie/otabwidget.cpp
+++ b/libopie/otabwidget.cpp
@@ -273,62 +273,69 @@ void OTabWidget::selectTab( OTabInfo *tab )
273 tabBar->tab( currentTab->id() )->setText( "" ); 273 tabBar->tab( currentTab->id() )->setText( "" );
274 setUpLayout(); 274 setUpLayout();
275 } 275 }
276 tabBar->tab( tab->id() )->setText( tab->label() ); 276 tabBar->tab( tab->id() )->setText( tab->label() );
277 tabBar->setCurrentTab( tab->id() ); 277 tabBar->setCurrentTab( tab->id() );
278 setUpLayout(); 278 setUpLayout();
279 tabBar->update(); 279 tabBar->update();
280 } 280 }
281 else 281 else
282 { 282 {
283 tabBar->setCurrentTab( tab->id() ); 283 tabBar->setCurrentTab( tab->id() );
284 } 284 }
285 285
286 widgetStack->raiseWidget( tab->control() ); 286 widgetStack->raiseWidget( tab->control() );
287 287
288 emit currentChanged( tab->control() ); 288 emit currentChanged( tab->control() );
289 289
290 currentTab = tab; 290 currentTab = tab;
291} 291}
292 292
293void OTabWidget::setUpLayout() 293void OTabWidget::setUpLayout()
294{ 294{
295 tabBar->layoutTabs(); 295 tabBar->layoutTabs();
296 QSize t( tabBarStack->sizeHint() ); 296 QSize t( tabBarStack->sizeHint() );
297 if ( t.width() > width() ) 297 if ( tabBarStyle == IconTab )
298 {
299 if ( t.width() > width() )
300 t.setWidth( width() );
301 }
302 else
303 {
298 t.setWidth( width() ); 304 t.setWidth( width() );
305 }
299 int lw = widgetStack->lineWidth(); 306 int lw = widgetStack->lineWidth();
300 if ( tabBarPosition == Bottom ) 307 if ( tabBarPosition == Bottom )
301 { 308 {
302 tabBarStack->setGeometry( QMAX(0, lw-2), height() - t.height() - lw, t.width(), t.height() ); 309 tabBarStack->setGeometry( QMAX(0, lw-2), height() - t.height() - lw, t.width(), t.height() );
303 widgetStack->setGeometry( 0, 0, width(), height()-t.height()+QMAX(0, lw-2) ); 310 widgetStack->setGeometry( 0, 0, width(), height()-t.height()+QMAX(0, lw-2) );
304 } 311 }
305 else 312 else
306 { 313 {
307 tabBarStack->setGeometry( QMAX(0, lw-2), 0, t.width(), t.height() ); 314 tabBarStack->setGeometry( QMAX(0, lw-2), 0, t.width(), t.height() );
308 widgetStack->setGeometry( 0, t.height()-lw, width(), height()-t.height()+QMAX(0, lw-2)); 315 widgetStack->setGeometry( 0, t.height()-lw, width(), height()-t.height()+QMAX( 0, lw-2 ) );
309 } 316 }
310 317
311 if ( autoMask() ) 318 if ( autoMask() )
312 updateMask(); 319 updateMask();
313} 320}
314 321
315QSize OTabWidget::sizeHint() const 322QSize OTabWidget::sizeHint() const
316{ 323{
317 QSize s( widgetStack->sizeHint() ); 324 QSize s( widgetStack->sizeHint() );
318 QSize t( tabBarStack->sizeHint() ); 325 QSize t( tabBarStack->sizeHint() );
319 return QSize( QMAX( s.width(), t.width()), s.height() + t.height() ); 326 return QSize( QMAX( s.width(), t.width() ), s.height() + t.height() );
320} 327}
321 328
322void OTabWidget::resizeEvent( QResizeEvent * ) 329void OTabWidget::resizeEvent( QResizeEvent * )
323{ 330{
324 setUpLayout(); 331 setUpLayout();
325} 332}
326 333
327int OTabWidget::getCurrentTab() { 334int OTabWidget::getCurrentTab() {
328 if ( currentTab ) 335 if ( currentTab )
329 { 336 {
330 return currentTab->id(); 337 return currentTab->id();
331 } 338 }
332 return -1; 339 return -1;
333} 340}
334 341