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
This commit is contained in:
Hugo Pereira Da Costa 2010-01-23 06:59:55 +00:00
parent 4874785fb4
commit c04cc31fa2
2 changed files with 17 additions and 6 deletions

View file

@ -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 );

View file

@ -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;