Improve section heading

Using spacing around the header and no hardcoded color by using
KColorscheme to get the base color and use the same alpha modulation
as KCategoryDrawer.

REVIEW: 116703
This commit is contained in:
Martin Gräßlin 2014-03-11 09:02:23 +01:00
parent 5c9ddcfff2
commit 9e81a26c2a
2 changed files with 14 additions and 4 deletions

View file

@ -128,6 +128,7 @@ class EffectFilterModel : public QSortFilterProxyModel
Q_PROPERTY(QColor backgroundActiveColor READ backgroundActiveColor CONSTANT); Q_PROPERTY(QColor backgroundActiveColor READ backgroundActiveColor CONSTANT);
Q_PROPERTY(QColor backgroundNormalColor READ backgroundNormalColor CONSTANT); Q_PROPERTY(QColor backgroundNormalColor READ backgroundNormalColor CONSTANT);
Q_PROPERTY(QColor backgroundAlternateColor READ backgroundAlternateColor CONSTANT); Q_PROPERTY(QColor backgroundAlternateColor READ backgroundAlternateColor CONSTANT);
Q_PROPERTY(QColor sectionColor READ sectionColor CONSTANT)
public: public:
EffectFilterModel(QObject *parent = 0); EffectFilterModel(QObject *parent = 0);
const QString &filter() const; const QString &filter() const;
@ -141,6 +142,12 @@ public:
QColor backgroundNormalColor() { return KColorScheme(QPalette::Active, KColorScheme::View, KSharedConfigPtr(0)).background(KColorScheme::NormalBackground).color(); }; QColor backgroundNormalColor() { return KColorScheme(QPalette::Active, KColorScheme::View, KSharedConfigPtr(0)).background(KColorScheme::NormalBackground).color(); };
QColor backgroundAlternateColor() { return KColorScheme(QPalette::Active, KColorScheme::View, KSharedConfigPtr(0)).background(KColorScheme::AlternateBackground).color(); }; QColor backgroundAlternateColor() { return KColorScheme(QPalette::Active, KColorScheme::View, KSharedConfigPtr(0)).background(KColorScheme::AlternateBackground).color(); };
QColor sectionColor() const {
QColor color = KColorScheme(QPalette::Active).foreground().color();
color.setAlphaF(0.6);
return color;
}
void defaults(); void defaults();
public Q_SLOTS: public Q_SLOTS:

View file

@ -31,14 +31,17 @@ Item {
id: sectionHeading id: sectionHeading
Rectangle { Rectangle {
width: parent.width width: parent.width
height:25 implicitHeight: sectionText.implicitHeight + 2 * col.spacing
color: "white" color: searchModel.backgroundNormalColor
Text { Text {
id: sectionText
x: col.spacing
y: col.spacing
text: section text: section
font.bold: true font.bold: true
font.pointSize: 16 color: searchModel.sectionColor
color: "gray" anchors.horizontalCenter: parent.horizontalCenter
} }
} }
} }