]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Fix wrong text color in Places Group Header. Use QPalette::Window for base color...
authorEmmanuel Pescosta <emmanuelpescosta099@gmail.com>
Tue, 14 Aug 2012 20:02:24 +0000 (22:02 +0200)
committerEmmanuel Pescosta <emmanuelpescosta099@gmail.com>
Wed, 15 Aug 2012 13:04:55 +0000 (15:04 +0200)
BUG: 303133
FIXED-IN: 4.9.1
(cherry picked from commit b3c3da985159a9627c079ad615cd77fc5f7bb72a)

src/kitemviews/kitemlistgroupheader.cpp
src/kitemviews/kitemlistgroupheader.h
src/kitemviews/kstandarditemlistwidget.cpp
src/kitemviews/kstandarditemlistwidget.h
src/panels/folders/foldersitemlistwidget.cpp
src/panels/folders/foldersitemlistwidget.h
src/panels/places/placesitemlistgroupheader.cpp
src/panels/places/placesitemlistgroupheader.h
src/panels/places/placesitemlistwidget.cpp
src/panels/places/placesitemlistwidget.h

index 576d20b881d45144b8cd5c8085605101f9b7f6b6..17c95a97c8f8e90fa7ca3d317d9f2780ae5d14ba 100644 (file)
@@ -180,10 +180,10 @@ void KItemListGroupHeader::updateCache()
 
     // Calculate the role- and line-color. No alphablending is used for
     // performance reasons.
 
     // Calculate the role- and line-color. No alphablending is used for
     // performance reasons.
-    const QColor c1 = m_styleOption.palette.text().color();
-    const QColor c2 = m_styleOption.palette.base().color();
+    const QColor c1 = textColor();
+    const QColor c2 = baseColor();
     m_separatorColor = mixedColor(c1, c2, 10);
     m_separatorColor = mixedColor(c1, c2, 10);
-    m_roleColor = mixedColor(c1, c2, 70);
+    m_roleColor = mixedColor(c1, c2, 60);
 
     const int padding = qMax(1, m_styleOption.padding);
     const int horizontalMargin = qMax(2, m_styleOption.horizontalMargin);
 
     const int padding = qMax(1, m_styleOption.padding);
     const int horizontalMargin = qMax(2, m_styleOption.horizontalMargin);
@@ -211,4 +211,26 @@ QColor KItemListGroupHeader::mixedColor(const QColor& c1, const QColor& c2, int
                   (c1.blue()  * c1Percent + c2.blue()  * c2Percent) / 100);
 }
 
                   (c1.blue()  * c1Percent + c2.blue()  * c2Percent) / 100);
 }
 
+QPalette::ColorRole KItemListGroupHeader::normalTextColorRole() const
+{
+    return QPalette::Text;
+}
+
+QPalette::ColorRole KItemListGroupHeader::normalBaseColorRole() const
+{
+    return QPalette::Window;
+}
+
+QColor KItemListGroupHeader::textColor() const
+{
+    const QPalette::ColorGroup group = isActiveWindow() ? QPalette::Active : QPalette::Inactive;
+    return styleOption().palette.color(group, normalTextColorRole());
+}
+
+QColor KItemListGroupHeader::baseColor() const
+{
+    const QPalette::ColorGroup group = isActiveWindow() ? QPalette::Active : QPalette::Inactive;
+    return styleOption().palette.color(group, normalBaseColorRole());
+}
+
 #include "kitemlistgroupheader.moc"
 #include "kitemlistgroupheader.moc"
index e19ab48718ead8eb9ba95490e4a9881195a01a98..1e8ed2cca1191c38c1471ddfa91222e9a4423da2 100644 (file)
@@ -104,11 +104,17 @@ protected:
     /** @reimp */
     virtual void resizeEvent(QGraphicsSceneResizeEvent* event);
 
     /** @reimp */
     virtual void resizeEvent(QGraphicsSceneResizeEvent* event);
 
+    virtual QPalette::ColorRole normalTextColorRole() const;
+    virtual QPalette::ColorRole normalBaseColorRole() const;
+
 private:
     void updateCache();
 
     static QColor mixedColor(const QColor& c1, const QColor& c2, int c1Percent = 50);
 
 private:
     void updateCache();
 
     static QColor mixedColor(const QColor& c1, const QColor& c2, int c1Percent = 50);
 
+    QColor textColor() const;
+    QColor baseColor() const;
+
 private:
     bool m_dirtyCache;
     QByteArray m_role;
 private:
     bool m_dirtyCache;
     QByteArray m_role;
index 69c5602c77378601cba2516f659f51122d33c1ca..3a76f14a2702fb63cdae7771dc6c62a6d734864e 100644 (file)
@@ -464,7 +464,7 @@ QFont KStandardItemListWidget::customizedFont(const QFont& baseFont) const
     return baseFont;
 }
 
     return baseFont;
 }
 
-QPalette::ColorRole KStandardItemListWidget::normalTextColorPalette() const
+QPalette::ColorRole KStandardItemListWidget::normalTextColorRole() const
 {
     return QPalette::Text;
 }
 {
     return QPalette::Text;
 }
@@ -485,8 +485,8 @@ QColor KStandardItemListWidget::textColor() const
     }
 
     const QPalette::ColorGroup group = isActiveWindow() ? QPalette::Active : QPalette::Inactive;
     }
 
     const QPalette::ColorGroup group = isActiveWindow() ? QPalette::Active : QPalette::Inactive;
-    const QPalette::ColorRole role = isSelected() ? QPalette::HighlightedText : normalTextColorPalette();
-    return styleOption().palette.brush(group, role).color();
+    const QPalette::ColorRole role = isSelected() ? QPalette::HighlightedText : normalTextColorRole();
+    return styleOption().palette.color(group, role);
 }
 
 void KStandardItemListWidget::setOverlay(const QPixmap& overlay)
 }
 
 void KStandardItemListWidget::setOverlay(const QPixmap& overlay)
index 462d83d0fad1b8b8785ffff9aa0f7971164582c7..787722ddd8db440f90e901ac645fa20706987a9d 100644 (file)
@@ -120,7 +120,7 @@ protected:
      */
     virtual QFont customizedFont(const QFont& baseFont) const;
 
      */
     virtual QFont customizedFont(const QFont& baseFont) const;
 
-    virtual QPalette::ColorRole normalTextColorPalette() const;
+    virtual QPalette::ColorRole normalTextColorRole() const;
 
     void setTextColor(const QColor& color);
     QColor textColor() const;
 
     void setTextColor(const QColor& color);
     QColor textColor() const;
index 5130592045e9b8e7553627b17df8a5a978a9af11..b4f9a5be8714346b2a6249d59c2283d1b5fb7236 100644 (file)
@@ -28,7 +28,7 @@ FoldersItemListWidget::~FoldersItemListWidget()
 {
 }
 
 {
 }
 
-QPalette::ColorRole FoldersItemListWidget::normalTextColorPalette() const
+QPalette::ColorRole FoldersItemListWidget::normalTextColorRole() const
 {
     return QPalette::WindowText;
 }
 {
     return QPalette::WindowText;
 }
index fa7b143aefad20434934c296a8062c8d6f8606c9..08d41b829c233549a489f91b7e69eacdec2ef0e0 100644 (file)
@@ -34,7 +34,7 @@ public:
     virtual ~FoldersItemListWidget();
 
 protected:
     virtual ~FoldersItemListWidget();
 
 protected:
-    virtual QPalette::ColorRole normalTextColorPalette() const;
+    virtual QPalette::ColorRole normalTextColorRole() const;
 };
 
 #endif
 };
 
 #endif
index 27d4c7917003e0ed3b4297b189e4d04f6313009a..ec7c4b18cd9b4bf93050e14e2dbfcdea8494b5f4 100644 (file)
@@ -37,4 +37,9 @@ void PlacesItemListGroupHeader::paintSeparator(QPainter* painter, const QColor&
     Q_UNUSED(color);
 }
 
     Q_UNUSED(color);
 }
 
+QPalette::ColorRole PlacesItemListGroupHeader::normalTextColorRole() const
+{
+    return QPalette::WindowText;
+}
+
 #include "placesitemlistgroupheader.moc"
 #include "placesitemlistgroupheader.moc"
index fbcd116f1ef8ec32b24f5738409fbb933503cda3..1c2d5cc25592e250a8f90ac085a30ba480fe28b4 100644 (file)
@@ -32,6 +32,8 @@ public:
 
 protected:
     virtual void paintSeparator(QPainter* painter, const QColor& color);
 
 protected:
     virtual void paintSeparator(QPainter* painter, const QColor& color);
+
+    virtual QPalette::ColorRole normalTextColorRole() const;
 };
 #endif
 
 };
 #endif
 
index 00f0fdab060a7c3b60855b0df8f77a83855ccdaa..e33d1daf97ac3c5bd2b540b641f6f9754224dc8f 100644 (file)
@@ -35,7 +35,7 @@ bool PlacesItemListWidget::isHidden() const
     return data().value("isHidden").toBool();
 }
 
     return data().value("isHidden").toBool();
 }
 
-QPalette::ColorRole PlacesItemListWidget::normalTextColorPalette() const
+QPalette::ColorRole PlacesItemListWidget::normalTextColorRole() const
 {
     return QPalette::WindowText;
 }
 {
     return QPalette::WindowText;
 }
index 93cd8f468c19ef30285da4950604e267ab814b81..a2a88c1f0fee48162f46a824689066f81dfb0749 100644 (file)
@@ -36,7 +36,7 @@ public:
 
 protected:
     virtual bool isHidden() const;
 
 protected:
     virtual bool isHidden() const;
-    virtual QPalette::ColorRole normalTextColorPalette() const;
+    virtual QPalette::ColorRole normalTextColorRole() const;
 };
 
 #endif
 };
 
 #endif