diff --git a/clients/tabstrip/tabstripdecoration.cpp b/clients/tabstrip/tabstripdecoration.cpp index 2459eb7261..36b940cab3 100644 --- a/clients/tabstrip/tabstripdecoration.cpp +++ b/clients/tabstrip/tabstripdecoration.cpp @@ -35,16 +35,6 @@ TabstripDecoration::TabstripDecoration( KDecorationBridge *bridge, KDecorationFa button = Qt::NoButton; } -TabstripDecoration::~TabstripDecoration() - { - for( int i = 0; i < closeButtons.size(); ++i ) - { - TabstripButton *btn = closeButtons.front(); - closeButtons.removeFirst(); - delete btn; - } - } - KCommonDecorationButton *TabstripDecoration::createButton( ButtonType type ) { switch( type ) @@ -151,9 +141,9 @@ void TabstripDecoration::paintEvent( QPaintEvent * ) // Delete unneeded tab close buttons while( tabCount < closeButtons.size() || ( tabCount == 1 && closeButtons.size() > 0 )) { - TabstripButton *btn = closeButtons.front(); - closeButtons.removeFirst(); - delete btn; + TabstripButton *btn = closeButtons.takeFirst(); + btn->hide(); + btn->deleteLater(); } if( tabCount > 1 ) @@ -255,12 +245,12 @@ bool TabstripDecoration::eventFilter( QObject* o, QEvent* e ) else if( e->type() == QEvent::Drop && widget() == o ) state = dropEvent( static_cast< QDropEvent* >( e ) ); - if( TabstripButton *btn = dynamic_cast< TabstripButton* >( o ) ) + if ( !state && e->type() == QEvent::MouseButtonRelease && + static_cast(e)->button() == Qt::LeftButton ) { - if( e->type() == QEvent::MouseButtonRelease ) + if( TabstripButton *btn = dynamic_cast< TabstripButton* >( o ) ) { - if( static_cast(e)->button() == Qt::LeftButton ) - { closeClientGroupItem( closeButtons.indexOf( btn ) ); } + closeClientGroupItem( closeButtons.indexOf( btn ) ); return true; } } diff --git a/clients/tabstrip/tabstripdecoration.h b/clients/tabstrip/tabstripdecoration.h index 53d6a9be48..5986f0b232 100644 --- a/clients/tabstrip/tabstripdecoration.h +++ b/clients/tabstrip/tabstripdecoration.h @@ -33,7 +33,6 @@ class TabstripDecoration : public KCommonDecorationUnstable { public: TabstripDecoration( KDecorationBridge *bridge, KDecorationFactory *factory ); - ~TabstripDecoration(); KCommonDecorationButton *createButton( ButtonType type ); void init(); QString visibleName() const;