diff --git a/src/plugins/texteditor/codeassist/genericproposalwidget.cpp b/src/plugins/texteditor/codeassist/genericproposalwidget.cpp index 6996048bffa..0c974729ccc 100644 --- a/src/plugins/texteditor/codeassist/genericproposalwidget.cpp +++ b/src/plugins/texteditor/codeassist/genericproposalwidget.cpp @@ -531,10 +531,10 @@ void GenericProposalWidget::updatePositionAndSize() QPoint pos = d->m_displayRect.bottomLeft(); pos.rx() -= 16 + fw; // Space for the icons if (pos.y() + height > screen.bottom()) - pos.setY(d->m_displayRect.top() - height); + pos.setY(qMax(0, d->m_displayRect.top() - height)); if (pos.x() + width > screen.right()) - pos.setX(screen.right() - width); - setGeometry(pos.x(), pos.y(), width, height); + pos.setX(qMax(0, screen.right() - width)); + setGeometry(pos.x(), pos.y(), qMin(width, screen.width()), qMin(height, screen.height())); } void GenericProposalWidget::turnOffAutoWidth()