目录

  • 解决 QtCreator 3.5.1无法输入中文的问题

    • 1、获取fctix-qt5源码
    • 2、生成Makefile文件
      • 2.1、没有找到"ECM"包配置文件报错
      • 2.2、找不到Qt5包配置文件的错误
      • 2.3、libxkbcommon问题
      • 2.4、'fcitx-utils' not found错误
    • 3、编译出动态库

解决 QtCreator 3.5.1无法输入中文的问题

环境是ubuntu 15.10
ubuntu软件源中下载安装的fctix-libs-qt5现在没有用,版本太旧了。
自己下载fctix-qt5的源码来编译即可。

1、获取fctix-qt5源码

我没有找到fcitx-qt5git仓库地址,只找到了源码包的下载地址。

先下载源码包,并解压。

wget https://download.fcitx-im.org/fcitx-qt5/fcitx-qt5-1.0.5.tar.xz
tar -xJf fcitx-qt5-1.0.5.tar.xz

找到了git仓库地址

git clone http://github.com/fcitx/fcitx-qt5.git

2、生成Makefile文件

这一步很简单,进入源码目录,然后新建一个build的目录并进入,然后使用cmake来生成Makefile

cd fcitx-qt5
mkdir build && cd build
cmake ..

这一个步骤产生了几个错误,这和系统环境有关。如果你的没有产生错误,后面就不用看了

2.1、没有找到"ECM"包配置文件报错

错误信息

cmake ..
-- The C compiler identification is GNU 5.2.1
-- The CXX compiler identification is Clang 3.7.0
... ...
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:8 (find_package):Could not find a package configuration file provided by "ECM" (requestedversion 1.4.0) with any of the following names:ECMConfig.cmakeecm-config.cmakeAdd the installation prefix of "ECM" to CMAKE_PREFIX_PATH or set "ECM_DIR"to a directory containing one of the above files.  If "ECM" provides aseparate development package or SDK, be sure it has been installed.-- Configuring incomplete, errors occurred!
See also "/home/o/fcitx/fcitx-qt5/CMakeFiles/CMakeOutput.log".

解决办法
先下载cmake的扩展模块包

wget https://launchpadlibrarian.net/189487929/extra-cmake-modules_1.4.0.orig.tar.xz
tar -xJf extra-cmake-modules_1.4.0.orig.tar.xz

进入其中,然后执行cmake .来生成Makefile文件
这一步需要指定两个变量

//The directory containing a CMake configuration file for Qt5Core.
Qt5Core_DIR:PATH=/home/o/program/qt_5.5/qt_5.5.1_x64/5.5/gcc_64/lib/cmake/Qt5Core//The directory containing a CMake configuration file for Qt5LinguistTools.
Qt5LinguistTools_DIR:PATH=/home/o/program/qt_5.5/qt_5.5.1_x64/5.5/gcc_64/lib/cmake/Qt5LinguistTools

2016年08月17日更新
上面一步其实直接指定Qt_DIR目录也就可以了。

#只需要指定Qt5_DIR路径即可
cmake -DQt5_DIR=/home/o/pragram/qt_5.7/5.7/gcc_64/lib/cmake/Qt5 .

生成了Makefile之后,直接sudo make install来安装就可以了。

2.2、找不到Qt5包配置文件的错误

报错信息

CMake Error at CMakeLists.txt:29 (find_package):Could not find a package configuration file provided by "Qt5" (requestedversion 5.1.0) with any of the following names:Qt5Config.cmakeqt5-config.cmakeAdd the installation prefix of "Qt5" to CMAKE_PREFIX_PATH or set "Qt5_DIR"to a directory containing one of the above files.  If "Qt5" provides aseparate development package or SDK, be sure it has been installed.-- Configuring incomplete, errors occurred!
See also "/home/o/fcitx/fcitx-qt5/build/CMakeFiles/CMakeOutput.log".

这个错误很好解决,设置变量Qt5_DIR即可

cmake -DQt5_DIR=/home/o/program/qt_5.5/qt_5.5.1_x64/5.5/gcc_64/lib/cmake/Qt5 ..

2.3、libxkbcommon问题

错误信息

o@o-pc:~/fcitx/fcitx-qt5/build$ cmake -DQt5_DIR=/home/o/program/qt_5.5/qt_5.5.1_x64/5.5/gcc_64/lib/cmake/Qt5  ..
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.28")
-- Found XKBCommon_XKBCommon: /usr/lib/x86_64-linux-gnu/libxkbcommon.so (found version "0.5.0")
-- Found XKBCommon: /usr/lib/x86_64-linux-gnu/libxkbcommon.so (found suitable version "0.5.0", minimum required is "0.5.0") found components:  XKBCommon
-- checking for module 'fcitx-utils'
--   package 'fcitx-utils' not found
CMake Error at /usr/share/cmake-3.2/Modules/FindPkgConfig.cmake:344 (message):A required package was not found
Call Stack (most recent call first):/usr/share/cmake-3.2/Modules/FindPkgConfig.cmake:506 (_pkg_check_modules_internal)CMakeLists.txt:32 (pkg_check_modules)-- Configuring incomplete, errors occurred!
See also "/home/o/fcitx/fcitx-qt5/build/CMakeFiles/CMakeOutput.log".

这个问题的解决如下
先下载libxkbcommon-0.5.0.tar.xz,然后解压编译

http://xkbcommon.org/download/libxkbcommon-0.5.0.tar.xz
tar -xJf libxkbcommon-0.5.0.tar.xz

这个使用./configure --disable-x11来生成Makefile。禁用x11是因为我机器上的x11版本过高的原因。

编译的时候可能会报错

 makeYACC     src/xkbcomp/parser.c
./build-aux/ylwrap: 行 176: yacc: 未找到命令
Makefile:1522: recipe for target 'src/xkbcomp/parser.c' failed
make: *** [src/xkbcomp/parser.c] Error 127

需要yacc的支持。这个工具包含在软件包bison中。

o@o-pc:~/fcitx/libxkbcommon-0.5.0$ sudo apt-get install bison

然后直接make && make install安装就是。

2.4、'fcitx-utils' not found错误

这个错误是因为我们没有安装fcitx-libs-dev的缘故,所以解决的办法就是安装它就是。
错误信息

o@o-pc:~/fcitx/fcitx-qt5/build$ cmake -DQt5_DIR=/home/o/program/qt_5.5/qt_5.5.1_x64/5.5/gcc_64/lib/cmake/Qt5  ..
-- checking for module 'fcitx-utils'
--   package 'fcitx-utils' not found
CMake Error at /usr/share/cmake-3.2/Modules/FindPkgConfig.cmake:344 (message):A required package was not found
Call Stack (most recent call first):/usr/share/cmake-3.2/Modules/FindPkgConfig.cmake:506 (_pkg_check_modules_internal)CMakeLists.txt:32 (pkg_check_modules)-- Configuring incomplete, errors occurred!

解决办法

sudo apt-get install fcitx-libs-dev 

3、编译出动态库

经过上面的步骤,生成了Makefile文件后,接下来的步骤就很简单了,直接make来编译即可。

 make
Scanning dependencies of target FcitxQt5DBusAddons_automoc
[  4%] Automatic moc for target FcitxQt5DBusAddons
... ... 中间步骤省略
Linking CXX shared module libfcitxplatforminputcontextplugin.so
[100%] Built target fcitxplatforminputcontextplugin

进入构建目录下的platforminputcontext目录,即可看到生成的libfcitxplatforminputcontextplugin.so文件
将其拷贝到QtCreator安装目录下的..../QtCreator/bin/plugins/platforminputcontexts目录下即可。

2016年08月17日更新
QtCreator 4.0的目录结构有一点小变化,需要将其拷贝到QtCreator目录下的QtCreator/lib/Qt/plugins/platforminputcontexts目录中。

o@o-pc:~/fcitx/fcitx-qt5/build/platforminputcontext$ ls
CMakeFiles  cmake_install.cmake  fcitxplatforminputcontextplugin_automoc.cpp  libfcitxplatforminputcontextplugin.so  Makefile  moc_main.cpp  moc_qfcitxplatforminputcontext.cpp
cp libfcitxplatforminputcontextplugin.so /home/o/program/qt_5.5/qt_5.5.1_x64/Tools/QtCreator/bin/plugins/platforminputcontexts/

解决 QtCreator 3.5(4.0)无法输入中文的问题相关推荐

  1. 解决Windows环境下Git Bash 不能输入中文的问题

    解决Windows环境下Git Bash 不能输入中文的问题 打开Git Bash后,对窗口右键->Options->Text->Locale改为zh_CN,Character se ...

  2. 解决ubuntu16.04 qt5.9.1无法输入中文

    1. 安装 fcitx-frontend-qt5 sudo apt-get install fcitx-frontend-qt5 2. 确认该路径下存在的文件 /usr/lib/x86_64-linu ...

  3. 解决Ubuntu输入法图标消失,不能输入中文的问题

    Ubuntu16右上角输入法图标突然消失,而且无法输入中文,可能是我刚安装的主题修改了系统配置导致的,我用的是fcitx,搜狗输入法. 解决办法: 1.清理搜狗输入法(可能不需要这一步) 删除用户目录 ...

  4. 解决Ubuntu18.04下Qt中无法输入中文的问题

    问题描述:我的中文输入法是搜狗的,但在qt中写代码时一直无法切换成中文,重启无效! 原因:安装的qt中缺少中文输入环境 解决办法: 进入到/usr/lib/x86_64-linux-gnu/qt5/p ...

  5. Ubuntu中Qt5.7.0无法输入中文

    把libfcitxplatforminputcontextplugin.so复制到安装的Qt目录下的两个文件夹中 sudo apt install fcitx-frontend-qt5sudo cp ...

  6. 解决在KDE桌面环境WebStorm不能输入中文问题

    由于jetbrains官方包的问题,Fcitx5输入法文字候选托盘暂时不能更改,如有最新解决办法,可查看ArchWiki官方,或者查看jetbrains官方 排查错误: cat /etc/locale ...

  7. 解决Ubuntu环境下不能QT不能输入中文

    参考链接: https://blog.csdn.net/baidu_33850454/article/details/81212026?utm_medium=distribute.pc_relevan ...

  8. 搜狗输入法在idea打不了汉字_IDEA下搜狗输入法输入中文时卡着不动的参考解决方法...

    在IntelliJ IDEA工具的java编辑窗口,给代码增加注释时发现,输入中文时,搜狗输入法界面不动,一直卡着,如图: 我想输入"根据"两个字,但搜狗输入法界面一直卡着不刷新, ...

  9. linux qtcreator输入中文,linux下QtCreator无法输入中文的情况

    解决linux下QtCreator无法输入中文的情况 安装了QtCreator5.3.1后无法输入中文,确切的说是无法打开输入法.以前使用iBus输入法的时候没有这个问题,现在使用sougou输入法才 ...

最新文章

  1. 差分霍尔器件测量电路
  2. 简单快速开发C\S架构程序用最简单的不分层最快的效率
  3. JavaScript 技术篇-js检测原生对象类型实例演示,js的3种对象类型
  4. java如何将表添加到文本区_java – 在itext中向表中的单元格添加更多文本
  5. jenkins linux虚拟机,Linux虚拟机安装Jenkins并实现部署
  6. 张宇高等数学强化阶段笔记并标记重点
  7. 发那科机器人点位编辑_【发那科】发那科机器人指令编辑大全
  8. MOEA/D算法原理及应用方向
  9. umi 导航菜单的空白页问题
  10. PayPal接口查询账户各币种余额
  11. Scheme 协议收集总结
  12. 微信上传图片没反应_365微信编辑器图片上传不了怎么办?
  13. 经典网络建设方案案例
  14. 多元数量值函数积分学
  15. Extjs页面实现行复制功能
  16. Matlab 2017a 安装、破解步骤
  17. Resource of computer vision, pattern recognition, machine learning etc.
  18. 换链接,群发和伪原创何时是尽头
  19. QT实现一个图片显示器,有登录界面(附图片,源码可直接使用)
  20. Invalid bound statement (not found): com.wxx.manager.mapper.GoodsCategoryMapper.selectByExample

热门文章

  1. VS2010可反复安装MSDN的方法
  2. cmd中安装app的的命令
  3. 数据库SQL语言类型(DQL.DML.DDL.DCL)
  4. Maven常用参数说明
  5. Linux服务器性能分析
  6. 记录一次svn报错:[Previous operation has not finished; run 'cleanup' if it was interrupted] 的排错过程
  7. 爬虫python代码网易云_python-网易云简单爬虫
  8. STL(八)——向量vector
  9. python亿级mysql数据库导出_Python实现将MySQL数据库表中的数据导出生成csv格式文件的方法...
  10. python中定义一个空的字符串_04python—15种字符串操作