summaryrefslogtreecommitdiffabout
path: root/microkde/kdeui/ktoolbar.cpp
Unidiff
Diffstat (limited to 'microkde/kdeui/ktoolbar.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kdeui/ktoolbar.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/microkde/kdeui/ktoolbar.cpp b/microkde/kdeui/ktoolbar.cpp
index 79b0f9d..e9226c0 100644
--- a/microkde/kdeui/ktoolbar.cpp
+++ b/microkde/kdeui/ktoolbar.cpp
@@ -1365,96 +1365,102 @@ void KToolBar::childEvent( QChildEvent *e )
1365 ::qstrcmp( "qt_dockwidget_internal", e->child()->name() ) != 0 ) { 1365 ::qstrcmp( "qt_dockwidget_internal", e->child()->name() ) != 0 ) {
1366 1366
1367 // prevent items that have been explicitly inserted by insert*() from 1367 // prevent items that have been explicitly inserted by insert*() from
1368 // being inserted again 1368 // being inserted again
1369 if ( !widget2id.contains( w ) ) 1369 if ( !widget2id.contains( w ) )
1370 { 1370 {
1371 int dummy = -1; 1371 int dummy = -1;
1372 insertWidgetInternal( w, dummy, -1 ); 1372 insertWidgetInternal( w, dummy, -1 );
1373 } 1373 }
1374 } 1374 }
1375 } else { 1375 } else {
1376 removeWidgetInternal( w ); 1376 removeWidgetInternal( w );
1377 } 1377 }
1378 if ( isVisibleTo( 0 ) ) 1378 if ( isVisibleTo( 0 ) )
1379 { 1379 {
1380 QBoxLayout *l = boxLayout(); 1380 QBoxLayout *l = boxLayout();
1381 // QLayout *l = layout(); 1381 // QLayout *l = layout();
1382 1382
1383 // clear the old layout so that we don't get unnecassery layout 1383 // clear the old layout so that we don't get unnecassery layout
1384 // changes till we have rebuild the thing 1384 // changes till we have rebuild the thing
1385 QLayoutIterator it = l->iterator(); 1385 QLayoutIterator it = l->iterator();
1386 while ( it.current() ) { 1386 while ( it.current() ) {
1387 it.deleteCurrent(); 1387 it.deleteCurrent();
1388 } 1388 }
1389 layoutTimer->start( 50, TRUE ); 1389 layoutTimer->start( 50, TRUE );
1390 } 1390 }
1391 } 1391 }
1392 QToolBar::childEvent( e ); 1392 QToolBar::childEvent( e );
1393} 1393}
1394 1394
1395void KToolBar::insertWidgetInternal( QWidget *w, int &index, int id ) 1395void KToolBar::insertWidgetInternal( QWidget *w, int &index, int id )
1396{ 1396{
1397 // we can't have it in widgets, or something is really wrong 1397 // we can't have it in widgets, or something is really wrong
1398 //widgets.removeRef( w ); 1398 //widgets.removeRef( w );
1399 1399
1400 connect( w, SIGNAL( destroyed() ), 1400 connect( w, SIGNAL( destroyed() ),
1401 this, SLOT( widgetDestroyed() ) ); 1401 this, SLOT( widgetDestroyed() ) );
1402 if ( index == -1 || index > (int)widgets.count() ) { 1402 if ( index == -1 || index > (int)widgets.count() ) {
1403 widgets.append( w ); 1403 widgets.append( w );
1404 index = (int)widgets.count(); 1404 index = (int)widgets.count();
1405 } 1405 }
1406 else 1406 else
1407 widgets.insert( index, w ); 1407 widgets.insert( index, w );
1408 if ( id == -1 ) 1408 if ( id == -1 )
1409 id = id2widget.count(); 1409 id = id2widget.count();
1410 id2widget.insert( id, w ); 1410 id2widget.insert( id, w );
1411 widget2id.insert( w, id ); 1411 widget2id.insert( w, id );
1412} 1412}
1413void KToolBar::repaintMe()
1414{
1415 setUpdatesEnabled( true );
1416 QToolBar::repaint( true );
1417 qDebug(" KToolBar::repaintMe() ");
1418}
1413 1419
1414void KToolBar::showEvent( QShowEvent *e ) 1420void KToolBar::showEvent( QShowEvent *e )
1415{ 1421{
1416 QToolBar::showEvent( e ); 1422 QToolBar::showEvent( e );
1417 rebuildLayout(); 1423 rebuildLayout();
1418} 1424}
1419 1425
1420void KToolBar::setStretchableWidget( QWidget *w ) 1426void KToolBar::setStretchableWidget( QWidget *w )
1421{ 1427{
1422 QToolBar::setStretchableWidget( w ); 1428 QToolBar::setStretchableWidget( w );
1423 stretchableWidget = w; 1429 stretchableWidget = w;
1424} 1430}
1425 1431
1426QSizePolicy KToolBar::sizePolicy() const 1432QSizePolicy KToolBar::sizePolicy() const
1427{ 1433{
1428 if ( orientation() == Horizontal ) 1434 if ( orientation() == Horizontal )
1429 return QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); 1435 return QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
1430 else 1436 else
1431 return QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Expanding ); 1437 return QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Expanding );
1432} 1438}
1433 1439
1434QSize KToolBar::sizeHint() const 1440QSize KToolBar::sizeHint() const
1435{ 1441{
1436 return QToolBar::sizeHint(); 1442 return QToolBar::sizeHint();
1437#if 0 1443#if 0
1438 QWidget::polish(); 1444 QWidget::polish();
1439 static int iii = 0; 1445 static int iii = 0;
1440 ++iii; 1446 ++iii;
1441 qDebug("++++++++ KToolBar::sizeHint() %d ", iii ); 1447 qDebug("++++++++ KToolBar::sizeHint() %d ", iii );
1442 int margin = static_cast<QWidget*>(ncThis)->layout()->margin(); 1448 int margin = static_cast<QWidget*>(ncThis)->layout()->margin();
1443 switch( barPos() ) 1449 switch( barPos() )
1444 { 1450 {
1445 case KToolBar::Top: 1451 case KToolBar::Top:
1446 case KToolBar::Bottom: 1452 case KToolBar::Bottom:
1447 for ( QWidget *w = widgets.first(); w; w =widgets.next() ) 1453 for ( QWidget *w = widgets.first(); w; w =widgets.next() )
1448 { 1454 {
1449 if ( w->inherits( "KToolBarSeparator" ) && 1455 if ( w->inherits( "KToolBarSeparator" ) &&
1450 !( static_cast<KToolBarSeparator*>(w)->showLine() ) ) 1456 !( static_cast<KToolBarSeparator*>(w)->showLine() ) )
1451 { 1457 {
1452 minSize += QSize(6, 0); 1458 minSize += QSize(6, 0);
1453 } 1459 }
1454 else 1460 else
1455 { 1461 {
1456 QSize sh = w->sizeHint(); 1462 QSize sh = w->sizeHint();
1457 if (!sh.isValid()) 1463 if (!sh.isValid())
1458 sh = w->minimumSize(); 1464 sh = w->minimumSize();
1459 minSize = minSize.expandedTo(QSize(0, sh.height())); 1465 minSize = minSize.expandedTo(QSize(0, sh.height()));
1460 minSize += QSize(sh.width()+1, 0); 1466 minSize += QSize(sh.width()+1, 0);