diff --git a/widgets/boxlayout.cpp b/widgets/boxlayout.cpp index 06cbfa034..dd664dba2 100644 --- a/widgets/boxlayout.cpp +++ b/widgets/boxlayout.cpp @@ -249,10 +249,6 @@ BoxLayout::BoxLayout(Direction direction , LayoutItem *parent) : Layout(parent), d(new Private(this)) { - if (parent) { - parent->setLayout(this); - } - d->direction = direction; } diff --git a/widgets/layout.cpp b/widgets/layout.cpp index 05aa30db6..ccb2de2ed 100644 --- a/widgets/layout.cpp +++ b/widgets/layout.cpp @@ -35,10 +35,10 @@ namespace Plasma class Layout::Private { public: - Private(LayoutItem* parent) + Private(LayoutItem* p) : margin(12.0), spacing(6.0), - parent(parent), + parent(p), animator(0) { } @@ -57,6 +57,9 @@ Layout::Layout(LayoutItem *parent) : LayoutItem(), d(new Private(parent)) { + if (parent) { + parent->setLayout(this); + } } void Layout::setParent(LayoutItem *parent) {