effect: Overwrite the output in OffscreenQuickView::setGeometry()

It seems like QWindow::setGeometry() won't update the associated output
if no platform window has been created, which is the case when running
overview or any other qml effect.

It's not clear whether this is a Qt bug or intended behavior.
qwindow.cpp contains comments assuming that the window is on the primary
output if no platform window exists.
This commit is contained in:
Vlad Zahorodnii 2024-01-25 12:22:13 +02:00
parent 601d33f294
commit 35572904fc

View file

@ -447,6 +447,8 @@ void OffscreenQuickView::setGeometry(const QRect &rect)
{
const QRect oldGeometry = d->m_view->geometry();
d->m_view->setGeometry(rect);
// QWindow::setGeometry() won't sync output if there's no platform window.
d->m_view->setScreen(QGuiApplication::screenAt(rect.center()));
Q_EMIT geometryChanged(oldGeometry, rect);
}