SVN commit 1217825 by aseigo: various cleanups M +1 -1 containment.cpp M +4 -4 corona.cpp M +5 -2 extenders/extender.cpp --- trunk/KDE/kdelibs/plasma/containment.cpp #1217824:1217825 @@ -528,7 +528,7 @@ Corona *Containment::corona() const { - return dynamic_cast(scene()); + return qobject_cast(scene()); } void Containment::mouseMoveEvent(QGraphicsSceneMouseEvent *event) --- trunk/KDE/kdelibs/plasma/corona.cpp #1217824:1217825 @@ -436,14 +436,14 @@ QRect Corona::screenGeometry(int id) const { Q_UNUSED(id); - if (views().isEmpty()) { - return sceneRect().toRect(); - } else { - QGraphicsView *v = views()[0]; + QGraphicsView *v = views().value(0); + if (v) { QRect r = sceneRect().toRect(); r.moveTo(v->mapToGlobal(QPoint(0, 0))); return r; } + + return sceneRect().toRect(); } QRegion Corona::availableScreenRegion(int id) const --- trunk/KDE/kdelibs/plasma/extenders/extender.cpp #1217824:1217825 @@ -913,9 +913,12 @@ { QRect screenRect; QSizeF size = mainWidget->effectiveSizeHint(Qt::PreferredSize); - if (applet && applet.data()->containment() && applet.data()->containment()->corona()) { - screenRect = applet.data()->containment()->corona()->screenGeometry(applet.data()->containment()->screen()); + if (applet) { + Containment *containment = applet.data()->containment(); + if (containment && containment->corona()) { + screenRect = containment->corona()->screenGeometry(containment->screen()); } + } q->resize(qMin(screenRect.width()/3, (int)size.width()), qMin(screenRect.height()/3, (int)size.height())); }