always use the parent's geometry when available and stop keeping track of our own geometry in FreeLayout

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=738036
This commit is contained in:
Aaron J. Seigo 2007-11-17 18:53:16 +00:00
parent 47130fbba5
commit e5dca92fdf

View File

@ -31,7 +31,6 @@ class FreeLayout::Private
{ {
public: public:
QList<LayoutItem*> children; QList<LayoutItem*> children;
QRectF geometry;
}; };
FreeLayout::FreeLayout(LayoutItem *parent) FreeLayout::FreeLayout(LayoutItem *parent)
@ -81,27 +80,32 @@ LayoutItem * FreeLayout::takeAt(int i)
return d->children.takeAt(i); return d->children.takeAt(i);
} }
void FreeLayout::setGeometry(const QRectF &geometry) void FreeLayout::setGeometry(const QRectF &)
{ {
foreach (LayoutItem *child , d->children) { foreach (LayoutItem *child , d->children) {
if (child->geometry().size() != child->sizeHint()) { if (child->geometry().size() != child->sizeHint()) {
child->setGeometry(QRectF(child->geometry().topLeft(),child->sizeHint())); child->setGeometry(QRectF(child->geometry().topLeft(), child->sizeHint()));
} }
} }
d->geometry = geometry;
} }
QRectF FreeLayout::geometry() const QRectF FreeLayout::geometry() const
{ {
return d->geometry; if (parent()) {
return parent()->geometry();
}
return QRectF(QPointF(0, 0), maximumSize());
} }
QSizeF FreeLayout::sizeHint() const QSizeF FreeLayout::sizeHint() const
{ {
if (parent()) { if (parent()) {
//kDebug() << "returning size hint from freelayout of" << parent()->geometry().size();
return parent()->geometry().size(); return parent()->geometry().size();
} }
//kDebug() << "returning size hint from freelayout of" << maximumSize();
return maximumSize(); return maximumSize();
} }