Fix check to keep QMenu on screen for multiscreen layouts

If x > screenWidth should be if x > screenLeft + screenWidth

otherwise all right hand screens get offset

REVIEW: 128148
This commit is contained in:
David Edmundson 2016-06-10 10:47:14 +01:00
parent 84c29fa3d0
commit f5ad210742

View File

@ -306,6 +306,7 @@ Q_INVOKABLE void QMenuProxy::openRelative()
using namespace Plasma; using namespace Plasma;
switch(m_placement) { switch(m_placement) {
case Types::TopPosedLeftAlignedPopup: case Types::TopPosedLeftAlignedPopup:
case Types::LeftPosedTopAlignedPopup: { case Types::LeftPosedTopAlignedPopup: {
@ -339,11 +340,11 @@ Q_INVOKABLE void QMenuProxy::openRelative()
QScreen *screen = parentItem->window()->screen(); QScreen *screen = parentItem->window()->screen();
if (screen) { if (screen) {
if (pos.x() + m_menu->width() > screen->geometry().width()) { if (pos.x() + m_menu->width() > (screen->geometry().x() + screen->geometry().width())) {
pos.setX(pos.x() - m_menu->width()); pos.setX(pos.x() - m_menu->width());
} }
if (pos.y() + m_menu->height() > screen->geometry().height()) { if (pos.y() + m_menu->height() > (screen->geometry().y() + screen->geometry().height())) {
pos.setY(pos.y() - m_menu->height()); pos.setY(pos.y() - m_menu->height());
} }
} }