[popup] Use QWindow::width instead of item.boundingRect to fix X

Since we are checking if the width() is out of bounds we should also use
width() to correct the position.

Other cases might need change as well, but I think we better go in a case
by case bases to fix all possible issues.
This commit is contained in:
Àlex Fiestas 2013-12-19 12:20:22 +01:00
parent 1ef1693749
commit 094303ee3f

View File

@ -269,7 +269,7 @@ QPoint DialogProxy::popupPosition(QQuickItem *item, Qt::AlignmentFlag alignment)
if (menuPos.x() + width() > avail.width() - rightMargin) { if (menuPos.x() + width() > avail.width() - rightMargin) {
// popup hits rhs // popup hits rhs
if (m_location == Plasma::Types::TopEdge || m_location == Plasma::Types::BottomEdge) { if (m_location == Plasma::Types::TopEdge || m_location == Plasma::Types::BottomEdge) {
menuPos.setX(avail.width() - item->boundingRect().width() + rightMargin); menuPos.setX(avail.width() - width() / 2 );
} else { } else {
menuPos.setX(pos.x() + leftPoint.x()); menuPos.setX(pos.x() + leftPoint.x());
} }