avoid an endless repaint loop

condition is still very convoluted but at least a lot faster

svn path=/trunk/KDE/kdelibs/; revision=890462
This commit is contained in:
Marco Martin 2008-11-29 13:06:12 +00:00
parent 807b2cf637
commit f4cf4b189b

View File

@ -115,17 +115,17 @@ public:
changed = true; changed = true;
} }
if (viewTransform.isScaling()) { if (changed || q->isToolbar() != viewTransform.isScaling()) {
q->setIsToolbar(true); if (!q->isToolbar()) {
q->showToolBox(); q->setIsToolbar(true);
return true; q->showToolBox();
} else { } else {
q->setIsToolbar(false); q->setIsToolbar(false);
if (changed) {
q->hideToolBox(); q->hideToolBox();
} }
return false;
} }
return q->isToolbar();
} }
DesktopToolBox *q; DesktopToolBox *q;
@ -374,6 +374,17 @@ void DesktopToolBox::showToolBox()
continue; continue;
} }
Plasma::IconWidget *icon = qgraphicsitem_cast<Plasma::IconWidget *>(tool);
if (icon) {
if (d->viewTransform.isScaling() && d->viewTransform.m11() < Plasma::scalingFactor(Plasma::GroupZoom)) {
icon->setText(QString());
icon->resize(icon->sizeFromIconSize(22));
} else {
icon->setText(icon->action()->text());
icon->resize(icon->sizeFromIconSize(22));
}
}
if (tool->isEnabled()) { if (tool->isEnabled()) {
//kDebug() << tool << "is enabled"; //kDebug() << tool << "is enabled";
y += 5; y += 5;
@ -436,17 +447,6 @@ void DesktopToolBox::showToolBox()
continue; continue;
} }
Plasma::IconWidget *icon = qgraphicsitem_cast<Plasma::IconWidget *>(tool);
if (icon) {
if (d->viewTransform.isScaling() && d->viewTransform.m11() < Plasma::scalingFactor(Plasma::GroupZoom)) {
icon->setText(QString());
icon->resize(icon->sizeFromIconSize(22));
} else {
icon->setText(icon->action()->text());
icon->resize(icon->sizeFromIconSize(22));
}
}
if (tool->isEnabled()) { if (tool->isEnabled()) {
if (isToolbar()) { if (isToolbar()) {
//kDebug() << tool << "is enabled"; //kDebug() << tool << "is enabled";