several layout fixes:
- extenderitem components have a fixed vertical size policy: they must not stretch when extenderitems are collapsed - one hardcoded size less -try to resize the internal scroller widget to sizehints in some case more svn path=/trunk/KDE/kdelibs/; revision=1112347
This commit is contained in:
parent
3ec50c411f
commit
fd5d33ee8a
@ -47,18 +47,17 @@ ExtenderGroup::ExtenderGroup(Extender *parent, uint groupId)
|
||||
|
||||
config().writeEntry("isGroup", true);
|
||||
|
||||
//FIXME: this ain't pretty
|
||||
setPreferredHeight(300);
|
||||
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
||||
|
||||
QGraphicsLinearLayout *lay = static_cast<QGraphicsLinearLayout *>(layout());
|
||||
d->scrollWidget = new ScrollWidget(this);
|
||||
d->scrollWidget->show();
|
||||
lay->addItem(d->scrollWidget);
|
||||
d->scrollWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
d->scrollWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
d->childsWidget = new QGraphicsWidget(d->scrollWidget);
|
||||
d->scrollWidget->setWidget(d->childsWidget);
|
||||
d->layout = new QGraphicsLinearLayout(Qt::Vertical, d->childsWidget);
|
||||
d->scrollWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::MinimumExpanding);
|
||||
|
||||
QAction *expand = new QAction(this);
|
||||
expand->setVisible(true);
|
||||
@ -201,14 +200,12 @@ void ExtenderGroup::collapseGroup()
|
||||
}
|
||||
d->scrollWidget->hide();
|
||||
static_cast<QGraphicsLinearLayout *>(layout())->removeItem(d->scrollWidget);
|
||||
extender()->resize(extender()->effectiveSizeHint(Qt::PreferredSize));
|
||||
extender()->resize(extender()->effectiveSizeHint(Qt::MinimumSize));
|
||||
}
|
||||
|
||||
void ExtenderGroup::resizeEvent(QGraphicsSceneResizeEvent *event)
|
||||
{
|
||||
ExtenderItem::resizeEvent(event);
|
||||
|
||||
d->scrollWidget->setGeometry(0, 70, size().width(), 400);
|
||||
}
|
||||
|
||||
ExtenderGroupPrivate::ExtenderGroupPrivate(ExtenderGroup *group)
|
||||
@ -227,8 +224,9 @@ ExtenderGroupPrivate::~ExtenderGroupPrivate()
|
||||
void ExtenderGroupPrivate::addItemToGroup(Plasma::ExtenderItem *item)
|
||||
{
|
||||
if (item->group() == q) {
|
||||
layout->addItem(item);
|
||||
item->setParentItem(childsWidget);
|
||||
layout->addItem(item);
|
||||
q->extender()->resize(q->extender()->effectiveSizeHint(Qt::PreferredSize).width(), q->extender()->size().height());
|
||||
childsWidget->resize(childsWidget->size().width(),
|
||||
childsWidget->effectiveSizeHint(Qt::PreferredSize).height());
|
||||
|
||||
|
@ -67,7 +67,7 @@ public:
|
||||
m_background(new FrameSvg(this))
|
||||
{
|
||||
m_background->setImagePath("widgets/extender-dragger");
|
||||
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||
updateTheme();
|
||||
}
|
||||
|
||||
@ -114,6 +114,7 @@ ExtenderItem::ExtenderItem(Extender *hostExtender, uint extenderItemId)
|
||||
d(new ExtenderItemPrivate(this, hostExtender))
|
||||
{
|
||||
Q_ASSERT(hostExtender);
|
||||
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||
|
||||
//set the extenderId
|
||||
if (extenderItemId) {
|
||||
|
Loading…
Reference in New Issue
Block a user