[Development] Changing keyboard layouts in Qt 5.1 apps with GNOME

Petko Ditchev pditchev at gmail.com
Mon Sep 2 13:28:15 CEST 2013


On 08/31/2013 07:35 PM, Thiago Macieira wrote:
> On sábado, 31 de agosto de 2013 14:51:58, Petko Ditchev wrote:
>>    I need some help troubleshooting a problem I've been having : for a
>> week now (I think since some updates to the keyboard layout settings in
>> gnome) I can't change the keyboard layout in QtCreator (built with
>> Qt5.1) and in my app that is on the same lib . Otherwise everything's ok
>> , but Qt5.1 apps stick with the layout they are launched with .
>>    I'm sending this to both lists because the bug affects GNOME , but not
>> Unity , and it affects Qt5.1 , but not Qt4 .
> Can you provide us with the output of setxkbmap -print before and after the
> keyboard change? It would be useful to get the xev output for a keystroke that
> changed too (before and after).
>
> Finally, can you make the same test by switching keyboard layouts with
> setxkbmap?
>
At last I got to doing the tests , sorry for the delay .

Output with the en_US layout:

setxkbmap -print
xkb_keymap {
xkb_keycodes { include "evdev+aliases(qwerty)" };
xkb_types { include "complete" };
xkb_compat { include "complete" };
xkb_symbols { include "pc+us+inet(evdev)+terminate(ctrl_alt_bksp)" };
xkb_geometry { include "pc(pc105)" };
};


Output with the bulgarian phonetic layout :

setxkbmap -print
xkb_keymap {
xkb_keycodes { include "evdev+aliases(qwerty)" };
xkb_types { include "complete" };
xkb_compat { include "complete" };
xkb_symbols { include 
"pc+bg(phonetic)+us:2+inet(evdev)+terminate(ctrl_alt_bksp)" };
xkb_geometry { include "pc(pc105)" };
};


That's the xprop for the window I'm testing on (it's my app) :

xprop
WM_STATE(WM_STATE):
window state: Normal
icon window: 0x0
_NET_FRAME_EXTENTS(CARDINAL) = 0, 0, 32, 0
_NET_WM_DESKTOP(CARDINAL) = 0
_NET_WM_ALLOWED_ACTIONS(ATOM) = _NET_WM_ACTION_MOVE, 
_NET_WM_ACTION_RESIZE, _NET_WM_ACTION_FULLSCREEN, 
_NET_WM_ACTION_MINIMIZE, _NET_WM_ACTION_SHADE, 
_NET_WM_ACTION_MAXIMIZE_HORZ, _NET_WM_ACTION_MAXIMIZE_VERT, 
_NET_WM_ACTION_CHANGE_DESKTOP, _NET_WM_ACTION_CLOSE, 
_NET_WM_ACTION_ABOVE, _NET_WM_ACTION_BELOW
_NET_WM_USER_TIME_WINDOW(WINDOW): window id # 0x1800011
_NET_WM_STATE(ATOM) = _NET_WM_STATE_MAXIMIZED_HORZ, 
_NET_WM_STATE_MAXIMIZED_VERT
_NET_WM_ICON(CARDINAL) =
XdndAware(ATOM) = BITMAP
_NET_WM_NAME(UTF8_STRING) = "Мисли -notes"
_MOTIF_WM_HINTS(_MOTIF_WM_HINTS) = 0x3, 0x3e, 0x7e, 0x0, 0x0
_NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_NORMAL
_XEMBED_INFO(_XEMBED_INFO) = 0x0, 0x0
WM_CLIENT_LEADER(WINDOW): window id # 0x1800002
WM_HINTS(WM_HINTS):
Client accepts input or input focus: True
Initial state is Normal State.
_NET_WM_PID(CARDINAL) = 3126
_NET_WM_SYNC_REQUEST_COUNTER(CARDINAL) = 25165838
WM_CLASS(STRING) = "misli", "misli"
WM_PROTOCOLS(ATOM): protocols WM_DELETE_WINDOW, WM_TAKE_FOCUS, 
_NET_WM_PING, _NET_WM_SYNC_REQUEST
WM_NORMAL_HINTS(WM_SIZE_HINTS):
user specified size: 800 by 600
program specified minimum size: 0 by 27
window gravity: Static

Then xev on the same window

$ xev -id 0x1800002 -event keyboard
(no output when I tried all kinds of keys on both layouts)
^C


$ xev -id 0x1800002

ColormapNotify event, serial 18, synthetic NO, window 0x1800002,
colormap 0x20, new NO, state ColormapInstalled

ColormapNotify event, serial 18, synthetic NO, window 0x1800002,
colormap 0x20, new NO, state ColormapUninstalled

With no specified -event that's the only output I got , when opening up 
some popup windows for file selection or something like that.

Last but not least :
setxkbmap en
setxkbmap bg
still don't change the keyboard layout on the Qt5.1.1 apps.

Do tell if there's anything else I can try out .

Petko




More information about the Development mailing list