* remove the screen based ctor. now we always require a containment.

* move some code into setContainment that was always needed, not just in setScreen
* fix a boolean logic error

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=786174
This commit is contained in:
Aaron J. Seigo 2008-03-16 07:19:27 +00:00
parent 6b53321428
commit 9c638f076d
2 changed files with 11 additions and 19 deletions

View File

@ -48,15 +48,6 @@ public:
Plasma::Containment *containment;
};
View::View(int screen, Corona *corona, QWidget *parent)
: QGraphicsView(parent),
d(new Private)
{
initGraphicsView();
setScene(corona);
setScreen(screen);
}
View::View(Containment *containment, QWidget *parent)
: QGraphicsView(parent),
d(new Private)
@ -95,11 +86,6 @@ void View::setScreen(int screen)
}
setContainment(corona->containmentForScreen(screen));
if (d->desktop < -1) {
// we want to set it to "all desktops" if we get ownership of
// a screen but don't have a desktop set
d->desktop = -1;
}
}
}
@ -143,11 +129,15 @@ void View::setContainment(Containment *containment)
}
d->containment = containment;
updateSceneRect();
if (containment) {
connect(containment, SIGNAL(geometryChanged()), this, SLOT(updateSceneRect()));
if (containment->screen() > -1 && d->desktop < -1) {
// we want to set it to "all desktops" if we get ownership of
// a screen but don't have a desktop explicitly set
d->desktop = -1;
}
updateSceneRect();
connect(containment, SIGNAL(geometryChanged()), this, SLOT(updateSceneRect()));
}
Containment* View::containment() const
@ -167,11 +157,14 @@ bool View::drawWallpaper() const
void View::updateSceneRect()
{
//kDebug( )<< "!!!!!!!!!!!!!!!!! setting the scene rect to" << d->containment->sceneBoundingRect();
if (!d->containment) {
return;
}
kDebug() << "!!!!!!!!!!!!!!!!! setting the scene rect to"
<< d->containment->sceneBoundingRect()
<< "associated screen is" << d->containment->screen();
emit sceneRectAboutToChange();
setSceneRect(d->containment->sceneBoundingRect());
emit sceneRectChanged();

1
view.h
View File

@ -38,7 +38,6 @@ class PLASMA_EXPORT View : public QGraphicsView
Q_OBJECT
public:
View(int screen, Corona *corona, QWidget *parent = 0);
explicit View(Containment *containment, QWidget *parent = 0);
~View();