in popupPosition() calculating if we are out of screen with the actual screen size instead of graphicsview size

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=765724
This commit is contained in:
Marco Martin 2008-01-24 15:44:11 +00:00
parent a083df39d5
commit 92ecb186df

View File

@ -33,6 +33,7 @@
#include <QPainter>
#include <QPixmapCache>
#include <QStyleOptionGraphicsItem>
#include <QDesktopWidget>
#include <KDebug>
@ -581,8 +582,14 @@ QPoint Widget::popupPosition(const QSize s) const
}
}
if (pos.rx() + s.width() > view()->width()) {
pos.rx() -= ((pos.rx() + s.width()) - view()->width());
//are we out of screen?
QRect screenRect = QApplication::desktop()->screenGeometry(pv->containment()->screen());
if (pos.rx() + s.width() > screenRect.width()) {
pos.rx() -= ((pos.rx() + s.width()) - screenRect.width());
}
if (pos.ry() + s.height() > screenRect.height()) {
pos.ry() -= ((pos.ry() + s.height()) - screenRect.height());
}
return pos;