From d87a1e7a0e31df271d72e553a67ac8d91305eb58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Thu, 26 Apr 2018 11:24:14 +0200 Subject: [PATCH] Make the locator popup track the window position Commit fe7ec249 changed the geometry update logic such that the popup geometry is updated after the popup becomes visible (and also on LayoutRequest), in order to to get a correct sizeHint from the (now) populated popup. However, this makes the dialog show at the previous position if the Qt Creator window has been moved and then jump to the correct position when the zero-timer fires. Make both cases work by updating the geometry immediately on show, and then with a delay on LayoutRequest. Change-Id: I5134347da58676a94bcc1fac3cf9b555662adc70 Reviewed-by: Eike Ziller --- src/plugins/coreplugin/locator/locatorwidget.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/plugins/coreplugin/locator/locatorwidget.cpp b/src/plugins/coreplugin/locator/locatorwidget.cpp index 59387ae2059..aaf77a52ccb 100644 --- a/src/plugins/coreplugin/locator/locatorwidget.cpp +++ b/src/plugins/coreplugin/locator/locatorwidget.cpp @@ -342,8 +342,11 @@ bool LocatorPopup::event(QEvent *event) { if (event->type() == QEvent::ParentChange) updateWindow(); - // completion list resizes after first items are shown --> LayoutRequest - else if (event->type() == QEvent::Show || event->type() == QEvent::LayoutRequest) + else if (event->type() == QEvent::Show) + // make sure the popup has correct position before it becomes visible + updateGeometry(); + else if (event->type() == QEvent::LayoutRequest) + // completion list resizes after first items are shown --> LayoutRequest QTimer::singleShot(0, this, &LocatorPopup::updateGeometry); return QWidget::event(event); }