[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [amarok] /: Use transparent background for lyrics browser
From:       Matěj_Laitl <matej () laitl ! cz>
Date:       2016-08-07 10:17:51
Message-ID: E1bWL9T-0002HX-DI () code ! kde ! org
[Download RAW message or body]

Git commit bdbb3a27f556c41910d3b814e5a4c73a2a93362f by Matěj Laitl, on behalf of Stefano Pettini.
Committed on 07/08/2016 at 09:42.
Pushed by laitl into branch 'master'.

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

M  +1    -0    ChangeLog
M  +5    -7    src/context/applets/lyrics/LyricsBrowser.cpp

http://commits.kde.org/amarok/bdbb3a27f556c41910d3b814e5a4c73a2a93362f

diff --git a/ChangeLog b/ChangeLog
index b5e55c3..5d8ca4a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -12,6 +12,7 @@ VERSION 2.9.0
   BUGFIXES:
    * Fix integer fields, like length, always showing up as zero in filter creation
      dialog; thanks to Stefano Pettini. (BR 341661)
+   * Fix background color of the lyrics applet, thanks to Stefano Pettini. (BR 314854)
 
 
 VERSION 2.8.90
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 );
 }
 
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic