Blob Blame History Raw
From bdbb3a27f556c41910d3b814e5a4c73a2a93362f Mon Sep 17 00:00:00 2001
From: Stefano Pettini <stefano.pettini@gmail.com>
Date: Sun, 19 Jun 2016 02:54:24 +0200
Subject: [PATCH 26/26] Use transparent background for lyrics browser

This makes the lyrics browser similar to every other context applet.
Please note that, when editing lyrics, the default textbox background
is still used.

REVIEW: 128246
BUG: 314854
---
 src/context/applets/lyrics/LyricsBrowser.cpp | 12 +++++-------
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/context/applets/lyrics/LyricsBrowser.cpp b/src/context/applets/lyrics/LyricsBrowser.cpp
index abcfe64..d948fea 100644
--- a/src/context/applets/lyrics/LyricsBrowser.cpp
+++ b/src/context/applets/lyrics/LyricsBrowser.cpp
@@ -41,7 +41,6 @@ LyricsBrowser::LyricsBrowser( QGraphicsWidget *parent )
     native->setWordWrapMode( QTextOption::WordWrap );
     native->setCursorWidth( 0 );
     native->document()->setDocumentMargin( 10 );
-    native->viewport()->setAutoFillBackground( true );
     native->setTextInteractionFlags( Qt::TextBrowserInteraction | Qt::TextSelectableByKeyboard );
 
     Plasma::Svg *borderSvg = new Plasma::Svg( this );
@@ -105,10 +104,11 @@ void LyricsBrowser::setLyrics( const QString &lyrics )
 
 void LyricsBrowser::setReadOnly( bool readOnly )
 {
-    QPalette::ColorRole bg = readOnly ? QPalette::Base : QPalette::AlternateBase;
-    nativeWidget()->viewport()->setBackgroundRole( bg );
-    nativeWidget()->setReadOnly( readOnly );
-    nativeWidget()->setCursorWidth( !readOnly ? 1 : 0 );
+    KTextBrowser *native = nativeWidget();
+
+    native->viewport()->setAutoFillBackground( !readOnly );
+    native->setReadOnly( readOnly );
+    native->setCursorWidth( !readOnly ? 1 : 0 );
 }
 
 void LyricsBrowser::setRichText( bool richText )
@@ -122,8 +122,6 @@ void LyricsBrowser::paletteChanged( const QPalette &palette )
     // set text color using app theme instead of plasma theme
     p.setColor( QPalette::Text, qApp->palette().text().color() );
 
-    QPalette::ColorRole bg = isReadOnly() ? QPalette::Base : QPalette::AlternateBase;
-    nativeWidget()->viewport()->setBackgroundRole( bg );
     nativeWidget()->setPalette( p );
 }
 
-- 
2.7.4