resize to the proper size when an item is collapsed/restored
svn path=/trunk/KDE/kdelibs/; revision=1186431
This commit is contained in:
parent
616a10059d
commit
32e10a77d2
@ -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) {
|
||||
|
@ -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<QGraphicsLayoutItem *>(extender()->d->mainWidget)->updateGeometry();
|
||||
if (group()) {
|
||||
group()->layout()->invalidate();
|
||||
static_cast<QGraphicsLayoutItem *>(group())->updateGeometry();
|
||||
}
|
||||
|
||||
extender()->resize(extender()->d->mainWidget->effectiveSizeHint(Qt::PreferredSize));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -74,6 +74,7 @@ class ExtenderPrivate
|
||||
void updateBorders();
|
||||
void delayItemAddedEvent();
|
||||
void updateEmptyExtenderLabel();
|
||||
void adjustMinimumSize();
|
||||
ExtenderGroup *findGroup(const QString &name) const;
|
||||
|
||||
Extender *q;
|
||||
|
Loading…
Reference in New Issue
Block a user