keyboard mapping wrong only in specific applications under TightVNC
This sounds very much like a known bug: TightVNC doesn't support XKEYBOARD, which confuses Qt5. (XKEYBOARD is one of several widely-supported extensions to the original X11 protocol.) The bug report against the Qt project has a comment that states that it is unlikely to be fixed because lack of XKEYBOARD is rare. The Debian bug report suggests using TurboVNC instead of TightVNC; it's a fork of TightVNC which implements some additional extensions including XKEYBOARD.