Fix disconnecting from the previously focused window


focusWindowChanged() used the QObject::disconnect(receiver, method)
overload, which forwards to disconnect(this, nullptr, receiver, method).
The sender is therefore the input panel itself rather than the focus
window, so neither call removed the connections made to
QWindow::visibleChanged and QWindow::screenChanged for an earlier focus
window.

Consequently the input panel stayed connected to every window that ever
had focus. A window that is no longer focused could still trigger
focusWindowVisibleChanged(), hiding the input panel while another window
is being edited, or screenChanged(), moving the panel to the screen of
an unfocused window. The Qt::UniqueConnection flag only prevented
duplicate connections to one and the same window, not the stale ones.

Store the connection handles and disconnect through them. The
connections are now always removed before new ones are made, so
Qt::UniqueConnection is no longer needed.

Fixes: QTBUG-148606
Pick-to: 6.12 6.11 6.8
Change-Id: I7abb38e19a333748dc66f27eb31566effe7b6f16
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
commit433c4bd9672287297218e7287556ebaf0a6757f4
parent454b704d271251db623caff7ec1149b54377a2e4
authorJarkko Koivikko <jarkko.koivikko@code-q.fi>
committerJarkko Koivikko <jarkko.koivikko@code-q.fi>
commit timeWed, 29 Jul 2026 06:08:03 +0000