Check if containment() actually returns a containment, and if view() actually returns a
view. Should fix a crash reported by chani. svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=811785
This commit is contained in:
parent
e97bd8e855
commit
e9989989c5
22
applet.cpp
22
applet.cpp
@ -1325,11 +1325,25 @@ QRect Applet::screenRect() const
|
|||||||
bottomRight.setX(bottomRight.x() + size().width());
|
bottomRight.setX(bottomRight.x() + size().width());
|
||||||
bottomRight.setY(bottomRight.y() + size().height());
|
bottomRight.setY(bottomRight.y() + size().height());
|
||||||
|
|
||||||
QPoint tL = containment()->view()->mapToGlobal(containment()->view()->mapFromScene(pos()));
|
Containment *c;
|
||||||
QPoint bR = containment()->view()->mapToGlobal(containment()->view()->mapFromScene(bottomRight));
|
c = containment();
|
||||||
kDebug() << "screenRect = " << QPoint(tL.x(), tL.y()), QSize(bR.x() - tL.x(), bR.y() - tL.y());
|
|
||||||
|
|
||||||
return QRect(QPoint(tL.x(), tL.y()), QSize(bR.x() - tL.x(), bR.y() - tL.y()));
|
if (c) {
|
||||||
|
QGraphicsView *v;
|
||||||
|
v = c->view();
|
||||||
|
|
||||||
|
if (v) {
|
||||||
|
QPoint tL = v->mapToGlobal(v->mapFromScene(pos()));
|
||||||
|
QPoint bR = v->mapToGlobal(v->mapFromScene(bottomRight));
|
||||||
|
|
||||||
|
kDebug() << "screenRect = " << QPoint(tL.x(), tL.y()), QSize(bR.x() - tL.x(), bR.y() - tL.y());
|
||||||
|
return QRect(QPoint(tL.x(), tL.y()), QSize(bR.x() - tL.x(), bR.y() - tL.y()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//The applet isn't in any containment, or in a containment that doesn't have a view on it.
|
||||||
|
//So a screenRect isn't relevant.
|
||||||
|
return QRect(QPoint(0, 0), QSize(0, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Applet::raise()
|
void Applet::raise()
|
||||||
|
Loading…
Reference in New Issue
Block a user