Commit 2ca1cc58 authored by Giulio Camuffo's avatar Giulio Camuffo Committed by Giulio Camuffo
Browse files

Get the popup mouse position for the right screen


If the parent window of the popup is not on the primary screen
use the right one to get the mouse position.

Change-Id: Ib9929e6fdf90dfae2457486edc9504719bdaad8b
Reviewed-by: default avatarRichard Moe Gustavsen <richard.gustavsen@digia.com>
parent 758026de
No related merge requests found
Showing with 5 additions and 3 deletions
......@@ -367,14 +367,16 @@ QQuickWindow *QQuickMenu::findParentWindow()
void QQuickMenu::popup()
{
QPoint mousePos = QCursor::pos();
QQuickWindow *parentWindow = findParentWindow();
QScreen *screen = parentWindow ? parentWindow->screen() : qGuiApp->primaryScreen();
QPoint mousePos = QCursor::pos(screen);
if (mousePos.x() == int(qInf())) {
// ### fixme: no mouse pos registered. Get pos from touch...
mousePos = qGuiApp->primaryScreen()->availableGeometry().center();
mousePos = screen->availableGeometry().center();
}
if (QQuickWindow *parentWindow = findParentWindow())
if (parentWindow)
mousePos = parentWindow->mapFromGlobal(mousePos);
__popup(QRectF(mousePos.x(), mousePos.y(), 0, 0));
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment