From 3b3c111e48c1ab6ed16489b3cd20952856e6c910 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Fri, 9 Apr 2010 13:05:48 +0000 Subject: [PATCH] tery with different size policies svn path=/trunk/KDE/kdelibs/; revision=1112902 --- extenders/extender.cpp | 1 + extenders/extendergroup.cpp | 10 ++++------ extenders/extenderitem.cpp | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/extenders/extender.cpp b/extenders/extender.cpp index 1793a46f9..9ec9f9468 100644 --- a/extenders/extender.cpp +++ b/extenders/extender.cpp @@ -103,6 +103,7 @@ Extender::Extender(Applet *applet) delete applet->d->extender.data(); } applet->d->extender = this; + setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); setContentsMargins(0, 0, 0, 0); d->layout = new QGraphicsLinearLayout(this); diff --git a/extenders/extendergroup.cpp b/extenders/extendergroup.cpp index 632571375..63e9d79d3 100644 --- a/extenders/extendergroup.cpp +++ b/extenders/extendergroup.cpp @@ -56,7 +56,8 @@ ExtenderGroup::ExtenderGroup(Extender *parent, uint groupId) d->childsWidget->installEventFilter(this); d->scrollWidget->setWidget(d->childsWidget); d->layout = new QGraphicsLinearLayout(Qt::Vertical, d->childsWidget); - d->scrollWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + d->childsWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); + d->scrollWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); QAction *expand = new QAction(this); expand->setVisible(true); @@ -175,10 +176,6 @@ void ExtenderGroup::expandGroup() } d->scrollWidget->show(); static_cast(layout())->addItem(d->scrollWidget); - - //resize to the bax between our hint and extender one - //TODO: do this on every childswidget resize? - extender()->resize(extender()->effectiveSizeHint(Qt::PreferredSize).expandedTo(effectiveSizeHint(Qt::PreferredSize))); } void ExtenderGroup::collapseGroup() @@ -202,7 +199,6 @@ void ExtenderGroup::collapseGroup() } d->scrollWidget->hide(); static_cast(layout())->removeItem(d->scrollWidget); - extender()->resize(extender()->effectiveSizeHint(Qt::MinimumSize)); } void ExtenderGroup::resizeEvent(QGraphicsSceneResizeEvent *event) @@ -237,6 +233,7 @@ void ExtenderGroupPrivate::addItemToGroup(Plasma::ExtenderItem *item) { if (item->group() == q) { item->setParentItem(childsWidget); + item->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); layout->addItem(item); layout->activate(); @@ -261,6 +258,7 @@ void ExtenderGroupPrivate::removeItemFromGroup(Plasma::ExtenderItem *item) childsWidget->resize(childsWidget->size().width(), childsWidget->effectiveSizeHint(Qt::PreferredSize).height()); layout->removeItem(item); + item->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); } } diff --git a/extenders/extenderitem.cpp b/extenders/extenderitem.cpp index 053bc45b1..54d1fd076 100644 --- a/extenders/extenderitem.cpp +++ b/extenders/extenderitem.cpp @@ -114,7 +114,7 @@ ExtenderItem::ExtenderItem(Extender *hostExtender, uint extenderItemId) d(new ExtenderItemPrivate(this, hostExtender)) { Q_ASSERT(hostExtender); - setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); + setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); //set the extenderId if (extenderItemId) {