don't let the popups escape from their containment
resolves part of 184983 CCBUG:184983 svn path=/trunk/KDE/kdelibs/; revision=942063
This commit is contained in:
parent
47a6a491d7
commit
4f9f85cee9
34
corona.cpp
34
corona.cpp
@ -494,16 +494,42 @@ QPoint Corona::popupPosition(const QGraphicsItem *item, const QSize &s)
|
|||||||
|
|
||||||
switch (loc) {
|
switch (loc) {
|
||||||
case BottomEdge:
|
case BottomEdge:
|
||||||
pos = QPoint(pos.x(), v->geometry().y() - s.height());
|
case TopEdge: {
|
||||||
|
//TODO: following line makes them centered.
|
||||||
|
//could make it better or worse, must be decided
|
||||||
|
//pos.setX(pos.x() + item->boundingRect().width()/2 - s.width()/2);
|
||||||
|
if (pos.x() + s.width() > v->geometry().right()) {
|
||||||
|
pos.setX(v->geometry().right() - s.width());
|
||||||
|
} else {
|
||||||
|
pos.setX(qMax(pos.x(), v->geometry().left()));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case LeftEdge:
|
||||||
|
case RightEdge: {
|
||||||
|
//pos.setY(pos.y() + item->boundingRect().height()/2 - s.height()/2);
|
||||||
|
if (pos.y() + s.height() > v->geometry().bottom()) {
|
||||||
|
pos.setY(v->geometry().bottom() - s.height());
|
||||||
|
} else {
|
||||||
|
pos.setY(qMax(pos.y(), v->geometry().top()));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
switch (loc) {
|
||||||
|
case BottomEdge:
|
||||||
|
pos.setY(v->geometry().y() - s.height());
|
||||||
break;
|
break;
|
||||||
case TopEdge:
|
case TopEdge:
|
||||||
pos = QPoint(pos.x(), v->geometry().bottom());
|
pos.setY(v->geometry().bottom());
|
||||||
break;
|
break;
|
||||||
case LeftEdge:
|
case LeftEdge:
|
||||||
pos = QPoint(v->geometry().right(), pos.y());
|
pos.setX(v->geometry().right());
|
||||||
break;
|
break;
|
||||||
case RightEdge:
|
case RightEdge:
|
||||||
pos = QPoint(v->geometry().x() - s.width(), pos.y());
|
pos.setX(v->geometry().x() - s.width());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (pos.y() - s.height() > 0) {
|
if (pos.y() - s.height() > 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user