ok, second try based on tzander's response. i think this should work better and be a nice come back from lunch toy for him to play/test with.

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=773999
This commit is contained in:
Aaron J. Seigo 2008-02-12 10:07:45 +00:00
parent 5b394a752f
commit e27b0ca4d0

View File

@ -553,9 +553,6 @@ QPoint Widget::popupPosition(const QSize s) const
loc = pv->containment()->location(); loc = pv->containment()->location();
} }
QRect screenRect = QApplication::desktop()->screenGeometry(pv ? pv->containment()->screen() : -1);
pos += screenRect.topLeft();
switch (loc) { switch (loc) {
case BottomEdge: case BottomEdge:
pos = QPoint(pos.x(), pos.y() - s.height()); pos = QPoint(pos.x(), pos.y() - s.height());
@ -579,9 +576,12 @@ QPoint Widget::popupPosition(const QSize s) const
//are we out of screen? //are we out of screen?
QRect screenRect = QApplication::desktop()->screenGeometry(pv ? pv->containment()->screen() : -1);
if (pos.rx() + s.width() > screenRect.right()) { if (pos.rx() + s.width() > screenRect.right()) {
pos.rx() -= ((pos.rx() + s.width()) - screenRect.right()); pos.rx() -= ((pos.rx() + s.width()) - screenRect.right());
} }
if (pos.ry() + s.height() > screenRect.bottom()) { if (pos.ry() + s.height() > screenRect.bottom()) {
pos.ry() -= ((pos.ry() + s.height()) - screenRect.bottom()); pos.ry() -= ((pos.ry() + s.height()) - screenRect.bottom());
} }