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
This commit is contained in:
parent
cbca152d48
commit
abcef60190
2 changed files with 25 additions and 2 deletions
|
@ -820,6 +820,12 @@ void AuroraeScene::addTab(const QString &caption)
|
|||
static_cast<QGraphicsLinearLayout*>(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<AuroraeTab*>(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<AuroraeTab*>(item)) {
|
||||
tab->activeChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int AuroraeScene::tabCount() const
|
||||
|
|
|
@ -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<AuroraeScene*>(scene())->isActive();
|
||||
AuroraeScene *s = static_cast<AuroraeScene*>(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());
|
||||
|
|
Loading…
Reference in a new issue