changed painting order of old/new caption and embossed/main text when title text transition is called, to avoid flicker. Also removed automatic text elision on old caption

svn path=/trunk/KDE/kdebase/workspace/; revision=1062149
This commit is contained in:
Hugo Pereira Da Costa 2009-12-13 23:24:36 +00:00
parent 3810ed6ff4
commit c5c464226d
2 changed files with 32 additions and 7 deletions

View file

@ -817,12 +817,18 @@ namespace Oxygen
if( titleIsAnimated() )
{
// due to alpha blending issues, one must first draw the contrast text,
// then the plain text.
if( contrast.isValid() )
{
painter->translate( 0, 1 );
if( !oldCaption().isEmpty() ) {
renderTitleText(
painter, rect, oldCaption(),
helper().alphaColor( color, 1.0 - titleOpacity() ),
contrast.isValid() ? helper().alphaColor( contrast, 1.0 - titleOpacity() ):contrast );
helper().alphaColor( contrast, 1.0 - titleOpacity() ),
QColor(), false );
}
@ -830,8 +836,27 @@ namespace Oxygen
renderTitleText(
painter, rect, caption(),
helper().alphaColor( color, titleOpacity() ),
contrast.isValid() ? helper().alphaColor( contrast, titleOpacity() ):contrast );
helper().alphaColor( contrast, titleOpacity() ), QColor() );
}
painter->translate( 0, -1 );
}
if( !oldCaption().isEmpty() ) {
renderTitleText(
painter, rect, oldCaption(),
helper().alphaColor( color, 1.0 - titleOpacity() ), QColor(), false );
}
if( !caption().isEmpty() ) {
renderTitleText(
painter, rect, caption(),
helper().alphaColor( color, titleOpacity() ), QColor() );
}
@ -844,11 +869,11 @@ namespace Oxygen
}
//_______________________________________________________________________
void OxygenClient::renderTitleText( QPainter* painter, const QRect& rect, const QString& caption, const QColor& color, const QColor& contrast ) const
void OxygenClient::renderTitleText( QPainter* painter, const QRect& rect, const QString& caption, const QColor& color, const QColor& contrast, bool elide ) const
{
Qt::Alignment alignment( configuration().titleAlignment() | Qt::AlignVCenter );
QString local( QFontMetrics( painter->font() ).elidedText( caption, Qt::ElideRight, rect.width() ) );
QString local( elide ? QFontMetrics( painter->font() ).elidedText( caption, Qt::ElideRight, rect.width() ):caption );
// translate title down in case of maximized window
if( isMaximized() ) painter->translate( 0, 2 );

View file

@ -260,7 +260,7 @@ namespace Oxygen
//! title text
/*! second color, if valid, is for contrast pixel */
virtual void renderTitleText( QPainter*, const QRect&, const QString&, const QColor&, const QColor& = QColor() ) const;
virtual void renderTitleText( QPainter*, const QRect&, const QString&, const QColor&, const QColor& = QColor(), bool elide = true ) const;
//! GroupItem
virtual void renderItem( QPainter*, int, const QPalette& );