Fix heading level line break handling with Qt 6.3

The old code was assuming it can read the previous heading level after
applying the current key press, which doesn't need to be the case when
enter/return is pressed. This seems to have worked due to the base
implementation happening to preserve the heading level, which isn't the
case in Qt 6.3 anymore. So, read the old heading level early enough, and
set the desired new one in all cases.
6 jobs for !23 with work/vkrause/qt6-unit-test-fixes in 4 minutes and 50 seconds (queued for 4 seconds)
latest merge request