Utils: Ensure that VariableChooser window title bar stays on screen

Prevent negative y-coordinates when centering the VariableChooser
over the launching toolbutton.

Fixes: QTCREATORBUG-27054
Change-Id: I4212c7120470f8c2014fbe27205de8430cd13a6f
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Alessandro Portale
2022-02-12 13:43:27 +01:00
parent 81218043d0
commit 8dcb5097f5

View File

@@ -544,7 +544,7 @@ void VariableChooserPrivate::updatePositionAndShow(bool)
{
if (QWidget *w = q->parentWidget()) {
QPoint parentCenter = w->mapToGlobal(w->geometry().center());
q->move(parentCenter.x() - q->width()/2, parentCenter.y() - q->height()/2);
q->move(parentCenter.x() - q->width()/2, qMax(parentCenter.y() - q->height()/2, 0));
}
q->show();
q->raise();