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=1121963icc-effect-5.14.5
parent
299574c546
commit
94e42cf134
|
@ -89,7 +89,7 @@ bool KDecorationPreview::recreateDecoration( KDecorationPlugins* plugins )
|
||||||
//deco[Active]->widget()->show();
|
//deco[Active]->widget()->show();
|
||||||
|
|
||||||
//deco[Inactive]->widget()->render( this, deco[Inactive]->widget()->mapToParent( QPoint(0,0) ) );
|
//deco[Inactive]->widget()->render( this, deco[Inactive]->widget()->mapToParent( QPoint(0,0) ) );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,6 +126,8 @@ void KDecorationPreview::paintEvent( QPaintEvent* e )
|
||||||
|
|
||||||
QPixmap KDecorationPreview::preview( QTextDocument* document, QWidget* widget )
|
QPixmap KDecorationPreview::preview( QTextDocument* document, QWidget* widget )
|
||||||
{
|
{
|
||||||
|
Q_UNUSED( document );
|
||||||
|
Q_UNUSED( widget );
|
||||||
QPixmap pixmap( size() );
|
QPixmap pixmap( size() );
|
||||||
pixmap.fill( Qt::transparent );
|
pixmap.fill( Qt::transparent );
|
||||||
|
|
||||||
|
@ -138,25 +140,6 @@ QPixmap KDecorationPreview::preview( QTextDocument* document, QWidget* widget )
|
||||||
{
|
{
|
||||||
QWidget *w = deco[Active]->widget();
|
QWidget *w = deco[Active]->widget();
|
||||||
w->render( &pixmap, w->mapToParent( QPoint(0, 0) ) );
|
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<KDecorationUnstable *>( 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;
|
return pixmap;
|
||||||
}
|
}
|
||||||
|
|
|
@ -288,7 +288,7 @@ void KCommonDecoration::resetLayout()
|
||||||
|
|
||||||
// shown instead of the window contents in decoration previews
|
// shown instead of the window contents in decoration previews
|
||||||
if(isPreview() ) {
|
if(isPreview() ) {
|
||||||
m_previewWidget = new QLabel(i18n("<center><b>%1 preview</b></center>", visibleName() ), widget());
|
m_previewWidget = new QLabel(i18n("<center><b>%1</b></center>", visibleName() ), widget());
|
||||||
m_previewWidget->setAutoFillBackground(true);
|
m_previewWidget->setAutoFillBackground(true);
|
||||||
m_previewWidget->show();
|
m_previewWidget->show();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue