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