That can be done using KDE’s own Custom Shortcuts (as long as it accepts the keyboard combinations you want to use) and borrowing techniques from other similar scripts (see this thread). The simpler way is to ditch other unreliable layout switchers and have a separate global shortcut for switching to each keyboard layout, and it is arguably better than having a single toggle shortcut, in many cases. The scripts can get the active window’s qube’s name like in my previous post here and then execute:
qvm-run $CUR_VM "setxkbmap de"
or better yet this line, because qvm-run has some weirdly huge added latency, which may be noticeable and problematic in a use case such as this:
qrexec-client -e -d $CUR_VM user:"setxkbmap de"
I haven’t tested this whole idea though.
I’ve myself given up on Fcitx5/IBus due to their flawed ways of detecting keyboard shortcuts and doing the layout switch and I’ve transitioned to sxhkd (in templates), which responds to key events reliably like KDE’s Shortcuts, but it’s more flexible with keyboard combinations, and it calls setxkbmap only for switching (rationale here at point 1 and instructions).