move popupleft when there is not enough room (it looks like the windowmanager doesn't always do it automatically)
svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=764755
This commit is contained in:
parent
ec2f627333
commit
e8b62a6ceb
@ -556,20 +556,30 @@ QPoint Widget::popupPosition(const QSize s) const
|
||||
|
||||
switch (loc) {
|
||||
case BottomEdge:
|
||||
return QPoint(pos.x(), pos.y() - s.height());
|
||||
pos = QPoint(pos.x(), pos.y() - s.height());
|
||||
break;
|
||||
case TopEdge:
|
||||
return QPoint(pos.x(), pos.y() + (int)size().height());
|
||||
pos = QPoint(pos.x(), pos.y() + (int)size().height());
|
||||
break;
|
||||
case LeftEdge:
|
||||
return QPoint(pos.x() + (int)size().width(), pos.y());
|
||||
pos = QPoint(pos.x() + (int)size().width(), pos.y());
|
||||
break;
|
||||
case RightEdge:
|
||||
return QPoint(pos.x() - s.width(), pos.y());
|
||||
pos = QPoint(pos.x() - s.width(), pos.y());
|
||||
break;
|
||||
default:
|
||||
if (pos.y() > 0) {
|
||||
return QPoint(pos.x(), pos.y() - s.height());
|
||||
pos = QPoint(pos.x(), pos.y() - s.height());
|
||||
} else {
|
||||
return QPoint(pos.x(), pos.y() + (int)size().height());
|
||||
pos = QPoint(pos.x(), pos.y() + (int)size().height());
|
||||
}
|
||||
}
|
||||
|
||||
if (pos.rx() + s.width() > view()->width()) {
|
||||
pos.rx() -= ((pos.rx() + s.width()) - view()->width());
|
||||
}
|
||||
|
||||
return pos;
|
||||
}
|
||||
|
||||
void Widget::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
||||
|
Loading…
Reference in New Issue
Block a user