From abcef601908b2366ab42702e7c805fbe23e50129 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Sat, 28 Aug 2010 12:00:03 +0000 Subject: [PATCH] Forward port revision 1169086: Update text shadow information whenever Tabs are added/removed in Aurorae. Fixes incorrect initial text shadow position in Aurorae. Unfortunately QGraphicsDropShadowEffect seems to be not side effect free. Updates to the scene are not propagated leaving the tabs in a wrong visual state. Therefore text shadow is disabled for window tabbing. I will investigate further to see if it gets fixed in Qt 4.7. CCBUG: 248754 svn path=/trunk/KDE/kdebase/workspace/; revision=1169087 --- clients/aurorae/src/lib/auroraescene.cpp | 14 +++++++++++++- clients/aurorae/src/lib/auroraetab.cpp | 13 ++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/clients/aurorae/src/lib/auroraescene.cpp b/clients/aurorae/src/lib/auroraescene.cpp index e24a78d4ad..832c27c302 100644 --- a/clients/aurorae/src/lib/auroraescene.cpp +++ b/clients/aurorae/src/lib/auroraescene.cpp @@ -820,6 +820,12 @@ void AuroraeScene::addTab(const QString &caption) static_cast(m_title->layout())->addItem(tab); tab->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); m_title->layout()->invalidate(); + // have to call active changed on each tab to update shadow effect + foreach (QGraphicsItem *item, items()) { + if (AuroraeTab *tab = dynamic_cast(item)) { + tab->activeChanged(); + } + } } void AuroraeScene::addTabs(const QStringList &captions) @@ -841,10 +847,16 @@ void AuroraeScene::removeLastTab() removeItem(tab); --m_tabCount; m_title->layout()->invalidate(); - return; + break; } } } + // have to call active changed on each tab to update shadow effect + foreach (QGraphicsItem *item, items()) { + if (AuroraeTab *tab = dynamic_cast(item)) { + tab->activeChanged(); + } + } } int AuroraeScene::tabCount() const diff --git a/clients/aurorae/src/lib/auroraetab.cpp b/clients/aurorae/src/lib/auroraetab.cpp index cab8bed498..eeb4a717cb 100644 --- a/clients/aurorae/src/lib/auroraetab.cpp +++ b/clients/aurorae/src/lib/auroraetab.cpp @@ -57,11 +57,22 @@ AuroraeTab::~AuroraeTab() void AuroraeTab::activeChanged() { + if (scene() == NULL) { + return; + } const ThemeConfig &config = m_theme->themeConfig(); if (!config.useTextShadow()) { return; } - const bool active = static_cast(scene())->isActive(); + AuroraeScene *s = static_cast(scene()); + if (s->tabCount() > 1) { + // graphics effect seems to be not side effect free and drops scheduled updates + // rendering tabs unreadable, therefore disabled. + m_effect->setEnabled(false); + } else { + m_effect->setEnabled(true); + } + const bool active = s->isActive(); m_effect->setXOffset(config.textShadowOffsetX()); m_effect->setYOffset(config.textShadowOffsetY()); m_effect->setColor(active ? config.activeTextShadowColor() : config.inactiveTextShadowColor());