PanelConfigView respects contrast effect settings

This commit is contained in:
Sebastian Kügler 2014-02-06 03:52:56 +01:00
parent 62de49128e
commit 15e4d93102
2 changed files with 13 additions and 5 deletions

View File

@ -48,11 +48,8 @@ PanelConfigView::PanelConfigView(Plasma::Containment *containment, PanelView *pa
setFlags(Qt::FramelessWindowHint);
KWindowEffects::enableBlurBehind(winId(), true);
if (qGray(m_theme.color(Plasma::Theme::BackgroundColor).rgb()) > 127) {
KWindowEffects::enableBackgroundContrast(winId(), true, 0.30, 1.9, 1.7);
} else {
KWindowEffects::enableBackgroundContrast(winId(), true, 0.45, 0.45, 1.7);
}
updateContrast();
connect(&m_theme, &Plasma::Theme::themeChanged, this, &PanelConfigView::updateContrast);
engine()->rootContext()->setContextProperty("panel", panelView);
engine()->rootContext()->setContextProperty("configDialog", this);
@ -70,6 +67,14 @@ void PanelConfigView::init()
syncGeometry();
}
void PanelConfigView::updateContrast()
{
KWindowEffects::enableBackgroundContrast(winId(), m_theme.backgroundContrastEnabled(),
m_theme.backgroundContrast(),
m_theme.backgroundIntensity(),
m_theme.backgroundSaturation());
}
void PanelConfigView::showAddWidgetDialog()
{
QAction *addWidgetAction = m_containment->actions()->action("add widgets");

View File

@ -56,6 +56,9 @@ protected:
protected Q_SLOTS:
void syncGeometry();
private Q_SLOTS:
void updateContrast();
private:
Plasma::Containment *m_containment;
PanelView *m_panelView;