Fix "invalid nullptr parameter" warning from QObject::connect


The window() of the QDeclarativeGeoMap item might be nullptr when it is
used in tests. And the window might also change if the item is move into
a different scene.

So only connect to a valid window pointer, and reconnect when the window
changes. This requires that we store a pointer to the old QQuickWindow
in the item, as we need to disconnect from the old window (and the
QQuickItem::itemChanged doesn't provide access to the old window).

Pick-to: 6.2
Change-Id: Id79a6c19990109d3900d5e483968b4f4cd4b2fbc
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
commitba100b1265ce00991df0cfe1f4c065749b602700
parenteb490443bcf13361aa3f3558f7b9772c86253bd5
authorVolker Hilsheimer <volker.hilsheimer@qt.io>
committerVolker Hilsheimer <volker.hilsheimer@qt.io>
commit timeTue, 30 Aug 2022 18:50:33 +0200