From 94e42cf1342abe7768599aa01c4548a38dc85254 Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Sun, 2 May 2010 20:25:27 +0000 Subject: [PATCH] Change KCommonDecoration preview label contents to contain only the decoration name Removed custom painting of kdecoration previews in kcmdecoration. svn path=/trunk/KDE/kdebase/workspace/; revision=1121963 --- kcmkwin/kwindecoration/preview.cpp | 23 +++-------------------- lib/kcommondecoration.cpp | 2 +- 2 files changed, 4 insertions(+), 21 deletions(-) diff --git a/kcmkwin/kwindecoration/preview.cpp b/kcmkwin/kwindecoration/preview.cpp index d875e8a67a..ed484da2cf 100644 --- a/kcmkwin/kwindecoration/preview.cpp +++ b/kcmkwin/kwindecoration/preview.cpp @@ -89,7 +89,7 @@ bool KDecorationPreview::recreateDecoration( KDecorationPlugins* plugins ) //deco[Active]->widget()->show(); //deco[Inactive]->widget()->render( this, deco[Inactive]->widget()->mapToParent( QPoint(0,0) ) ); - + return true; } @@ -126,6 +126,8 @@ void KDecorationPreview::paintEvent( QPaintEvent* e ) QPixmap KDecorationPreview::preview( QTextDocument* document, QWidget* widget ) { + Q_UNUSED( document ); + Q_UNUSED( widget ); QPixmap pixmap( size() ); pixmap.fill( Qt::transparent ); @@ -138,25 +140,6 @@ QPixmap KDecorationPreview::preview( QTextDocument* document, QWidget* widget ) { QWidget *w = deco[Active]->widget(); w->render( &pixmap, w->mapToParent( QPoint(0, 0) ) ); - int left, right, top, bottom; - deco[Active]->borders( left, right, top, bottom ); - int padLeft, padRight, padTop, padBottom; - padLeft = padRight = padTop = padBottom = 0; - if( KDecorationUnstable *unstable = qobject_cast( deco[Active] ) ) - { - unstable->padding( padLeft, padRight, padTop, padBottom ); - } - widget->setGeometry( 0, 0, - w->geometry().width() - left - right - padLeft - padRight, - w->geometry().height() - top - bottom - padTop - padBottom ); - QPoint topLeft = w->geometry().topLeft() + QPoint( left + padLeft, top + padTop ); - widget->render( &pixmap, topLeft ); - //Enable word-wrap - const int margin = 5; - document->setTextWidth( widget->width() - margin * 2 ); - QPainter painter( &pixmap ); - painter.translate( topLeft ); - document->drawContents( &painter, widget->geometry().adjusted( margin, margin, -margin, -margin )); } return pixmap; } diff --git a/lib/kcommondecoration.cpp b/lib/kcommondecoration.cpp index 3910633ad7..3cef096b5f 100644 --- a/lib/kcommondecoration.cpp +++ b/lib/kcommondecoration.cpp @@ -288,7 +288,7 @@ void KCommonDecoration::resetLayout() // shown instead of the window contents in decoration previews if(isPreview() ) { - m_previewWidget = new QLabel(i18n("
%1 preview
", visibleName() ), widget()); + m_previewWidget = new QLabel(i18n("
%1
", visibleName() ), widget()); m_previewWidget->setAutoFillBackground(true); m_previewWidget->show();