resize to the proper sizes when expanding/collapsing the groups

svn path=/trunk/KDE/kdelibs/; revision=1186426
This commit is contained in:
Marco Martin 2010-10-16 11:08:25 +00:00
parent f49d3bc29b
commit 616a10059d
2 changed files with 21 additions and 7 deletions

View File

@ -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)

View File

@ -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<QGraphicsLinearLayout *>(layout())->addItem(d->childsWidget);
updateGeometry();
foreach (ExtenderItem *item, extender()->attachedItems()) {
if (item->group() == this) {
item->show();
extender()->itemAddedEvent(item);
}
}
d->childsWidget->show();
static_cast<QGraphicsLinearLayout *>(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<QGraphicsLinearLayout *>(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<QGraphicsLinearLayout *>(layout())->removeItem(d->childsWidget);
}
void ExtenderGroup::resizeEvent(QGraphicsSceneResizeEvent *event)