drop the requirement of a containment on construction

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=852337
This commit is contained in:
Aaron J. Seigo 2008-08-25 19:25:15 +00:00
parent e293d7d785
commit 364aabf073

View File

@ -108,20 +108,24 @@ View::View(Containment *containment, QWidget *parent)
: QGraphicsView(parent), : QGraphicsView(parent),
d(new ViewPrivate(this, 0)) d(new ViewPrivate(this, 0))
{ {
Q_ASSERT(containment);
d->initGraphicsView(); d->initGraphicsView();
setScene(containment->scene());
setContainment(containment); if (containment) {
setScene(containment->scene());
setContainment(containment);
}
} }
View::View(Containment *containment, int viewId, QWidget *parent) View::View(Containment *containment, int viewId, QWidget *parent)
: QGraphicsView(parent), : QGraphicsView(parent),
d(new ViewPrivate(this, viewId)) d(new ViewPrivate(this, viewId))
{ {
Q_ASSERT(containment);
d->initGraphicsView(); d->initGraphicsView();
setScene(containment->scene());
setContainment(containment); if (containment) {
setScene(containment->scene());
setContainment(containment);
}
} }
@ -200,6 +204,8 @@ void View::setContainment(Plasma::Containment *containment)
int screen = -1; int screen = -1;
if (oldContainment) { if (oldContainment) {
screen = d->containment->screen(); screen = d->containment->screen();
} else {
setScene(containment->scene());
} }
d->containment = containment; d->containment = containment;