fixed calculation of title bounding rects when there is only one title being shown, to avoid issues when smooth title transition is enabled
svn path=/trunk/KDE/kdebase/workspace/; revision=1088001
This commit is contained in:
parent
a2f94886d0
commit
58b8722a6b
2 changed files with 10 additions and 22 deletions
|
@ -419,14 +419,6 @@ namespace Oxygen
|
|||
QRect OxygenClient::titleBoundingRect( const QFont& font, QRect rect, const QString& caption ) const
|
||||
{
|
||||
|
||||
// check bounding rect against titleRect
|
||||
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
|
||||
QRect boundingRect = QFontMetrics( font ).boundingRect( rect, configuration().titleAlignment() | Qt::AlignVCenter, caption );
|
||||
|
||||
|
@ -927,20 +919,25 @@ 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 ); }
|
||||
|
||||
// always make sure that titleRect never conflicts with window buttons
|
||||
QRect titleRect( OxygenClient::titleRect() );
|
||||
if( titleRect.left() > textRect.left() ) { textRect.setLeft( titleRect.left() ); }
|
||||
if( titleRect.right() < textRect.right() ) { textRect.setRight( titleRect.right() ); }
|
||||
|
||||
// title outline
|
||||
if( itemCount == 1 )
|
||||
{
|
||||
|
||||
|
||||
if( itemData_.isAnimated() ) {
|
||||
|
||||
textRect = titleBoundingRect( painter->font(), textRect, caption );
|
||||
renderTitleOutline( painter, item.boundingRect_, palette );
|
||||
|
||||
} else if( (isActive()||glowIsAnimated()) && configuration().drawTitleOutline() ) {
|
||||
|
||||
// adjust textRect
|
||||
textRect = titleBoundingRect( painter->font(), textRect, caption );
|
||||
|
||||
// adjusts boundingRect accordingly
|
||||
QRect boundingRect( item.boundingRect_ );
|
||||
boundingRect.setLeft( textRect.left() - layoutMetric( LM_TitleBorderLeft ) );
|
||||
|
|
|
@ -302,15 +302,6 @@ 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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue