Can't change keyboard layout in some Qt programs

It looks like it's a bug in Qt's event handling system for changing keynoard layout: bugzilla link.

Gatis Paeglis added a comment - 03/Dec/13 1:47 PM This is not a bug in Qt as suggested by a developer in https://mail.gnome.org/archives/desktop-devel-list/2013-September/msg00046.html The same resource suggests that the cause of the issue is that Qt doesn't listen for XkbNewKeyboardNotify events - this is wrong. XkbNewKeyboardNotify has nothing to do with keyboard layout changes. XkbNewKeyboardNotify event is fired when the actual hardware gets connected or disconnected, not when the keyboard layout changes. The actual issue is in Xlib as suggested in https://bugs.freedesktop.org/show_bug.cgi?id=23202 and in https://bugreports.qt-project.org/browse/QTBUG-30911. We can hope that one day xcb platform plugin won't need dependencies to Xlib anymore, which will allows us to use xcb event loop directly. This should also solve the "keyboard layout detection" issue. Here is the discussion about Xlib dependency in xcb plugin http://lists.qt-project.org/pipermail/development/2013-July/011965.html

As it's said, it affects only GTK based desktop enviroments, so you may want to swich to KDE. You can do it this way:

sudo apt-get install kubuntu-desktop