unbreak toolbox on zoomed out view

svn path=/trunk/KDE/kdelibs/; revision=930197
This commit is contained in:
Marco Martin 2009-02-22 20:18:08 +00:00
parent b2c950d01e
commit 8fe01d477c

View File

@ -417,17 +417,6 @@ void DesktopToolBox::showToolBox()
}
Plasma::IconWidget *icon = qgraphicsitem_cast<Plasma::IconWidget *>(tool);
if (icon) {
if (viewTransform().m11() != Plasma::scalingFactor(Plasma::OverviewZoom) &&
(viewTransform().m11() == Plasma::scalingFactor(Plasma::DesktopZoom) ||
icon->action() == d->containment->action("add sibling containment") ||
icon->action() == d->containment->action("add widgets"))) {
icon->setText(icon->action()->text());
} else {
icon->setText(QString());
}
}
if (tool->isEnabled()) {
tool->show();
//kDebug() << tool << "is enabled";
@ -439,6 +428,17 @@ void DesktopToolBox::showToolBox()
maxHeight = qMax(toolSize.height(), maxHeight);
y += static_cast<int>(tool->boundingRect().height());
}
if (icon) {
if (viewTransform().m11() != Plasma::scalingFactor(Plasma::OverviewZoom) &&
(viewTransform().m11() == Plasma::scalingFactor(Plasma::DesktopZoom) ||
icon->action() == d->containment->action("add sibling containment") ||
icon->action() == d->containment->action("add widgets"))) {
icon->setText(icon->action()->text());
} else {
icon->setText(QString());
}
}
}
if (corner() == TopRight || corner() == Right || corner() == BottomRight) {
@ -504,8 +504,14 @@ void DesktopToolBox::showToolBox()
}
Plasma::IconWidget *icon = qgraphicsitem_cast<Plasma::IconWidget *>(tool);
const int iconHeight = icon->sizeFromIconSize(KIconLoader::SizeSmallMedium).height();
icon->resize(maxWidth, iconHeight);
const QSize iconSizeHint = icon->sizeFromIconSize(KIconLoader::SizeSmallMedium).toSize();
//force max size if we aren't zooming
if (viewTransform().m11() == 1) {
icon->resize(maxWidth, iconSizeHint.height());
} else {
icon->resize(iconSizeHint);
}
if (tool->isEnabled()) {
if (isToolbar()) {