we don't need to create an another layout, just changing the direction work, there is

a big size problem when put the panel on the right or on the left, the length seems to 
be huge

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=798129
This commit is contained in:
Alexis Ménard 2008-04-17 15:29:28 +00:00
parent dcd0a9bbe9
commit c1a93efbdf

View File

@ -488,10 +488,8 @@ void Containment::setFormFactor(FormFactor formFactor)
QGraphicsLinearLayout * linearLay = dynamic_cast<QGraphicsLinearLayout *>(lay); QGraphicsLinearLayout * linearLay = dynamic_cast<QGraphicsLinearLayout *>(lay);
if (linearLay) { if (linearLay) {
foreach (Applet* applet, d->applets) { foreach (Applet* applet, d->applets) {
linearLay->addItem(applet);
applet->updateConstraints(Plasma::FormFactorConstraint); applet->updateConstraints(Plasma::FormFactorConstraint);
} }
//linearLay->addStretch();
} }
updateConstraints(Plasma::FormFactorConstraint); updateConstraints(Plasma::FormFactorConstraint);
} }
@ -506,20 +504,44 @@ void Containment::createLayout(FormFactor formFactor)
//setLayout(new QGraphicsLinearLayout()); //setLayout(new QGraphicsLinearLayout());
break; break;
case Horizontal: { case Horizontal: {
QGraphicsLinearLayout *lay = new QGraphicsLinearLayout(); if
lay->setOrientation(Qt::Horizontal); (!layout())
lay->setContentsMargins(0, 0, 0, 0); {
lay->setSpacing(4); QGraphicsLinearLayout *lay = new QGraphicsLinearLayout();
lay->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding)); lay->setOrientation(Qt::Horizontal);
setLayout(lay); lay->setContentsMargins(0, 0, 0, 0);
lay->setSpacing(4);
lay->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding));
setLayout(lay);
}
else
{
QGraphicsLayout *lay = layout();
QGraphicsLinearLayout * linearLay = dynamic_cast<QGraphicsLinearLayout *>(lay);
if (linearLay) {
linearLay->setOrientation(Qt::Horizontal);
}
}
break; break;
} }
case Vertical: { case Vertical: {
QGraphicsLinearLayout *lay = new QGraphicsLinearLayout(); if
lay->setOrientation(Qt::Vertical); (!layout())
lay->setContentsMargins(0, 0, 0, 0); {
lay->setSpacing(4); QGraphicsLinearLayout *lay = new QGraphicsLinearLayout();
setLayout(lay); lay->setOrientation(Qt::Vertical);
lay->setContentsMargins(0, 0, 0, 0);
lay->setSpacing(4);
setLayout(lay);
}
else
{
QGraphicsLayout *lay = layout();
QGraphicsLinearLayout * linearLay = dynamic_cast<QGraphicsLinearLayout *>(lay);
if (linearLay) {
linearLay->setOrientation(Qt::Vertical);
}
}
break; break;
} }
default: default: