From c1a93efbdfaf479abda4a1ab38a6d25c57153fa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20M=C3=A9nard?= Date: Thu, 17 Apr 2008 15:29:28 +0000 Subject: [PATCH] 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 --- containment.cpp | 48 +++++++++++++++++++++++++++++++++++------------- 1 file changed, 35 insertions(+), 13 deletions(-) diff --git a/containment.cpp b/containment.cpp index 8747bdd30..a25807131 100644 --- a/containment.cpp +++ b/containment.cpp @@ -488,10 +488,8 @@ void Containment::setFormFactor(FormFactor formFactor) QGraphicsLinearLayout * linearLay = dynamic_cast(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(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(lay); + if (linearLay) { + linearLay->setOrientation(Qt::Vertical); + } + } break; } default: