forked from qt-creator/qt-creator
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 <eike.ziller@qt.io>
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user