be safe (view can be null!) and don't call view() repeatedly as it requires tromping through all the views. not a killer in most situations, but nice to avoide unecessary work

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=874045
This commit is contained in:
Aaron J. Seigo 2008-10-20 16:42:37 +00:00
parent e5c19dde50
commit 1dc982c466

View File

@ -433,6 +433,12 @@ void PopupAppletPrivate::dialogStatusChanged(bool status)
void PopupAppletPrivate::updateDialogPosition()
{
QGraphicsView *view = q->view();
if (!view) {
return;
}
KConfigGroup sizeGroup = q->config();
sizeGroup = KConfigGroup(&sizeGroup, "PopupApplet");
const int width = qMin(sizeGroup.readEntry("DialogWidth", 0),
@ -450,8 +456,8 @@ void PopupAppletPrivate::updateDialogPosition()
}
QSize s = dialog->size();
QPoint pos = q->view()->mapFromScene(q->scenePos());
pos = q->view()->mapToGlobal(pos);
QPoint pos = view->mapFromScene(q->scenePos());
pos = view->mapToGlobal(pos);
switch (q->location()) {
case BottomEdge: