diff --git a/extenders/extender.cpp b/extenders/extender.cpp index 0c5b0f0c0..22e4add1b 100644 --- a/extenders/extender.cpp +++ b/extenders/extender.cpp @@ -504,10 +504,7 @@ void Extender::itemAddedEvent(ExtenderItem *item, const QPointF &pos) } } - //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())); + d->adjustMinimumSize(); //remove the empty extender message if needed. d->updateEmptyExtenderLabel(); @@ -530,10 +527,7 @@ 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())); + d->adjustMinimumSize(); //add the empty extender message if needed. d->updateEmptyExtenderLabel(); @@ -835,6 +829,14 @@ void ExtenderPrivate::updateEmptyExtenderLabel() } } +void ExtenderPrivate::adjustMinimumSize() +{ + //FIXME: hardcoded number for the scrollbar + scrollWidget->setMinimumWidth(mainWidget->effectiveSizeHint(Qt::MinimumSize).width() + 32); + //FIXME: hardcoded number + scrollWidget->setMinimumHeight(qMin((qreal)300, mainWidget->effectiveSizeHint(Qt::MinimumSize).height())); +} + ExtenderGroup *ExtenderPrivate::findGroup(const QString &name) const { foreach (ExtenderItem *item, attachedExtenderItems) { diff --git a/extenders/extenderitem.cpp b/extenders/extenderitem.cpp index 1a420390c..29c9658f4 100644 --- a/extenders/extenderitem.cpp +++ b/extenders/extenderitem.cpp @@ -600,8 +600,16 @@ void ExtenderItem::setCollapsed(bool collapsed) d->layout->insertItem(1, d->widget.data()); } updateGeometry(); + if (extender()) { - extender()->resize(extender()->effectiveSizeHint(Qt::PreferredSize)); + extender()->d->adjustMinimumSize(); + static_cast(extender()->d->mainWidget)->updateGeometry(); + if (group()) { + group()->layout()->invalidate(); + static_cast(group())->updateGeometry(); + } + + extender()->resize(extender()->d->mainWidget->effectiveSizeHint(Qt::PreferredSize)); } } } diff --git a/private/extender_p.h b/private/extender_p.h index 4be59f909..30866b969 100644 --- a/private/extender_p.h +++ b/private/extender_p.h @@ -74,6 +74,7 @@ class ExtenderPrivate void updateBorders(); void delayItemAddedEvent(); void updateEmptyExtenderLabel(); + void adjustMinimumSize(); ExtenderGroup *findGroup(const QString &name) const; Extender *q;