昨天安装了Ubuntu1404,然后在使用QtCreator时,依然无法输入中文,又有开发的需要,就再上网找找解决办法。下面把我找到的部分资料和处理步骤写下来,给别人提供些方便。
因为fcitx可以支持比较多的输入法,特别是中文输入,所以我就把ibus卸了,安装了fcitx,这个步骤网上太多。不在此再啰嗦。下面说对QT的支持:
1.安装fcitx-frontend-qt5
sudo apt-get install fcitx-frontend-qt5
2. 将安装后的fcitx-frontend-qt5复制到qt安装目录
通常,fcitx-frontend-qt5在下面的目录路径中(可用命令 dpkg -L 包名 看文件安装路径):
/usr/lib/x86_64-linux-gnu/qt5/plugins/platforminputcontexts/libfcitxplatforminputcontextplugin.so
将该文件复制到
qt安装目录//Tools/QtCreator/bin/plugins/platforminputcontexts
和
qt安装目录/5.3/gcc_64/plugins/platforminputcontexts
中
3. 修改一下系统配置文件:
/etc/X11/xinit/xinput.d/default,填入如下显示的红色内容:
#
# This configuration provides default IM setting (user edittable)
# See im-switch(8) and /usr/share/doc/im-switch/README.Debian .
#
# Define IM for traditional X application with XIM
#
# XIM server name used for XMODIFIERS="@im=$XIM"
# XIM program /path/filename
# XIM program command line arguments
#
# These were traditional setting before uim and scim for CJK languages
# Language LC_CTYPE XIM server XMODIFIERS Start key
# Japanese ja_JP* kinput2 "@im=kinput2" Shift-Space
# Korean ko_KR* ami "@im=Ami" Shift-Space
# Chinese(T) zh_TW.Big5 xcin "@im=xcin-zh_TW.big5" Ctrl-Space
# Chinese(S) zh_CN.GB2312 xcin "@im=xcin-zh_CN.GB2312" Ctrl-Space
#
XIM=fcitx
XIM_PROGRAM=/usr/bin/fcitx
XIM_ARGS="--xim"
XIM_PROGRAM_XTRA=
# Set following variable to non-zero string if program set itself as deamon
XIM_PROGRAM_SETS_ITSELF_AS_DAEMON=
#
# Define GTK and QT IM module
# They may or may not be using xim as the IM.
#
GTK_IM_MODULE=fcitx
QT_IM_MODULE=fcitx
#
# Define lists of packages neded for above IM to function
#
DEPENDS="fcitx,fcitx-frontend-qt5"
#
# Define X start up hook script to update IM environment
#
最后重启系统。大功告成。