From 616a10059d9b22d7620a674b9b86c31f9914c268 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Sat, 16 Oct 2010 11:08:25 +0000 Subject: [PATCH] resize to the proper sizes when expanding/collapsing the groups svn path=/trunk/KDE/kdelibs/; revision=1186426 --- extenders/extender.cpp | 10 +++++++++- extenders/extendergroup.cpp | 18 ++++++++++++------ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/extenders/extender.cpp b/extenders/extender.cpp index dd51d7cff..0c5b0f0c0 100644 --- a/extenders/extender.cpp +++ b/extenders/extender.cpp @@ -512,6 +512,8 @@ void Extender::itemAddedEvent(ExtenderItem *item, const QPointF &pos) //remove the empty extender message if needed. d->updateEmptyExtenderLabel(); d->updateBorders(); + + resize(d->mainWidget->effectiveSizeHint(Qt::PreferredSize)); } void Extender::itemRemovedEvent(ExtenderItem *item) @@ -528,12 +530,18 @@ void Extender::itemRemovedEvent(ExtenderItem *item) d->spacerWidget = 0; } + //FIXME: hardcoded number for the scrollbar + d->scrollWidget->setMinimumWidth(d->mainWidget->effectiveSizeHint(Qt::MinimumSize).width() + 32); + //FIXME: hardcoded number + d->scrollWidget->setMinimumHeight(qMin((qreal)300, d->mainWidget->effectiveSizeHint(Qt::MinimumSize).height())); + //add the empty extender message if needed. d->updateEmptyExtenderLabel(); d->updateBorders(); updateGeometry(); - resize(effectiveSizeHint(Qt::PreferredSize)); + + resize(d->mainWidget->effectiveSizeHint(Qt::PreferredSize)); } void Extender::itemHoverEnterEvent(ExtenderItem *item) diff --git a/extenders/extendergroup.cpp b/extenders/extendergroup.cpp index c22e78961..7fa03c2e2 100644 --- a/extenders/extendergroup.cpp +++ b/extenders/extendergroup.cpp @@ -167,16 +167,19 @@ void ExtenderGroup::expandGroup() config().writeEntry("groupCollapsed", d->collapsed); action("collapse")->setVisible(true); action("expand")->setVisible(false); + + d->childsWidget->show(); + static_cast(layout())->addItem(d->childsWidget); + updateGeometry(); + foreach (ExtenderItem *item, extender()->attachedItems()) { if (item->group() == this) { item->show(); extender()->itemAddedEvent(item); } } - d->childsWidget->show(); - static_cast(layout())->addItem(d->childsWidget); - updateGeometry(); - extender()->resize(extender()->effectiveSizeHint(Qt::PreferredSize)); + + //extender()->resize(extender()->effectiveSizeHint(Qt::PreferredSize)); } void ExtenderGroup::collapseGroup() @@ -192,14 +195,17 @@ void ExtenderGroup::collapseGroup() config().writeEntry("groupCollapsed", d->collapsed); action("collapse")->setVisible(false); action("expand")->setVisible(true); + + d->childsWidget->hide(); + static_cast(layout())->removeItem(d->childsWidget); + updateGeometry(); + foreach (ExtenderItem *item, extender()->attachedItems()) { if (item != this && item->group() == this) { item->hide(); extender()->itemRemovedEvent(item); } } - d->childsWidget->hide(); - static_cast(layout())->removeItem(d->childsWidget); } void ExtenderGroup::resizeEvent(QGraphicsSceneResizeEvent *event)