[kde-doc-english] [trojita] src/Gui: GUI: use theme-dependent colors for the FindBar search result indicators

Jan Kundrát jkt at flaska.net
Wed May 1 15:31:39 UTC 2013


Git commit d53b3e6973a394acc5be2dd7d9f69b5813f61abc by Jan Kundrát.
Committed on 01/05/2013 at 17:22.
Pushed by jkt into branch 'master'.

GUI: use theme-dependent colors for the FindBar search result indicators

Thanks to Thomas Lübking for his suggestion.

M  +6    -9    src/Gui/FindBar.cpp

http://commits.kde.org/trojita/d53b3e6973a394acc5be2dd7d9f69b5813f61abc

diff --git a/src/Gui/FindBar.cpp b/src/Gui/FindBar.cpp
index 227f35f..9d2002f 100644
--- a/src/Gui/FindBar.cpp
+++ b/src/Gui/FindBar.cpp
@@ -35,6 +35,7 @@
 #include <QWebFrame>
 #include <QWebView>
 #include "LineEdit.h"
+#include "Gui/Util.h"
 
 namespace Gui {
 
@@ -165,18 +166,14 @@ void FindBar::setVisible(bool visible)
 
 void FindBar::notifyMatch(bool match)
 {
-    QPalette p = m_lineEdit->palette();
-
     if (m_lineEdit->text().isEmpty()) {
-        p.setColor(QPalette::Base, palette().color(QPalette::Base));
+        m_lineEdit->setPalette(QPalette());
     } else {
-        if (match) {
-            p.setColor(QPalette::Base, QColor(230, 247, 230));
-        } else {
-            p.setColor(QPalette::Base, QColor(247, 230, 230));
-        }
+        QColor backgroundTint = match ? QColor(0, 0xff, 0, 0x20) : QColor(0xff, 0, 0, 0x20);
+        QPalette p;
+        p.setColor(QPalette::Base, Gui::Util::tintColor(p.color(QPalette::Base), backgroundTint));
+        m_lineEdit->setPalette(p);
     }
-    m_lineEdit->setPalette(p);
 }
 
 



More information about the kde-doc-english mailing list