From c04cc31fa25e7142cf3d7345d2fcba84e80ad870 Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Sat, 23 Jan 2010 06:59:55 +0000 Subject: [PATCH] fixed title bounding rect conflict with window buttons when dragging a tab away from (or back in) a 2-tabs window, with the second tab title being very long svn path=/trunk/KDE/kdebase/workspace/; revision=1078906 --- clients/oxygen/oxygenclient.cpp | 14 ++++++++------ clients/oxygen/oxygenclient.h | 9 +++++++++ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/clients/oxygen/oxygenclient.cpp b/clients/oxygen/oxygenclient.cpp index 97a5cb6056..4ef9b66e85 100644 --- a/clients/oxygen/oxygenclient.cpp +++ b/clients/oxygen/oxygenclient.cpp @@ -420,13 +420,11 @@ namespace Oxygen { // check bounding rect against titleRect - // conflicts can happen only if there is only one item in group - if( itemData_.count() == 1 ) + if( titleRectCanConflict() ) { QRect titleRect( OxygenClient::titleRect() ); if( titleRect.left() > rect.left() ) { rect.setLeft( titleRect.left() ); } if( titleRect.right() < rect.right() ) { rect.setRight( titleRect.right() ); } - } // get title bounding rect @@ -929,10 +927,14 @@ namespace Oxygen const QList< ClientGroupItem >& items( clientGroupItems() ); QString caption( itemCount == 1 ? OxygenClient::caption() : items[index].title() ); + // make sure title rect never conflicts with decoration buttons + if( titleRectCanConflict() ) + { textRect = titleBoundingRect( painter->font(), textRect, caption ); } + // title outline - if( itemCount == 1 ) { - - textRect = titleBoundingRect( painter->font(), textRect, caption ); + if( itemCount == 1 ) + { + if( itemData_.isAnimated() ) { renderTitleOutline( painter, item.boundingRect_, palette ); diff --git a/clients/oxygen/oxygenclient.h b/clients/oxygen/oxygenclient.h index 7636392784..9a4aa2068c 100644 --- a/clients/oxygen/oxygenclient.h +++ b/clients/oxygen/oxygenclient.h @@ -302,6 +302,15 @@ namespace Oxygen !isPreview(); } + //! returns true if drawn item can conflict with buttons. + /*! + this might happen either + - when there is only one item in the group + - when there are two items but the second is being dragged in or away + */ + bool titleRectCanConflict( void ) const + { return ( itemData_.count() == 1 || ( itemData_.count() == 2 && (itemData_.animationType()&AnimationSameTarget) ) ); } + //! calculate mask QRegion calcMask( void ) const;