tdf#160838 qt: Update IM cursor position also on modifier change

In `QtWidget::handleKeyEvent`, move the call to

    QGuiApplication::inputMethod()->update(Qt::ImCursorRectangle);

further up, so the cursor update also happens for the code path
of calling the `SalEvent::KeyModChange` callback and then returning
early.

This makes fcitx5's keyboard layout indicator show up at the right
position again when switching layout right after starting Writer
(s. tdf#160838 comment comment 2), which was no longer the case
after the new code path had been introduced in

    commit 862fdb98ca271b60a831cd5420fd16d5f9c1c747
    Date:   Mon Jul 19 15:17:53 2021 +0200

        tdf#143298 Qt5 send SalEvent::KeyModChange events

(Not sure whether it wouldn't even make more sense
to update *after* processing the key event for the
case that actual text is typed, as that presumably
modifies the cursor position, but leave the logic
otherwise unchanged for now.)

Change-Id: I6e21ae51568eefc8e2ae64109d5596f5e20cc28a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166923
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
diff --git a/vcl/qt5/QtWidget.cxx b/vcl/qt5/QtWidget.cxx
index 996a0a7..5c86033 100644
--- a/vcl/qt5/QtWidget.cxx
+++ b/vcl/qt5/QtWidget.cxx
@@ -580,6 +580,8 @@ bool QtWidget::handleKeyEvent(QtFrame& rFrame, const QWidget& rWidget, QKeyEvent
        return true;
    }

    QGuiApplication::inputMethod()->update(Qt::ImCursorRectangle);

    if (nCode == 0 && pEvent->text().isEmpty())
    {
        sal_uInt16 nModCode = GetKeyModCode(pEvent->modifiers());
@@ -669,8 +671,6 @@ bool QtWidget::handleKeyEvent(QtFrame& rFrame, const QWidget& rWidget, QKeyEvent
    aEvent.mnCode = nCode;
    aEvent.mnCode |= GetKeyModCode(pEvent->modifiers());

    QGuiApplication::inputMethod()->update(Qt::ImCursorRectangle);

    bool bStopProcessingKey;
    if (bIsKeyPressed)
        bStopProcessingKey = rFrame.CallCallback(SalEvent::KeyInput, &aEvent);