This change is preparation for Qt 6, and it fixes an experimental build
with Qt 6.2.4 as copying of `QEvent` has been disabled in Qt 6.0.0 (see
19f9b0d5f54379151eb71e98555b203ad6756276 upstream commit).
This is a backport of [[https://github.com/bitcoin/bitcoin/pull/580 | core#580]]
Depends on D18139