解决 QtCreator 3.5(4.0)无法输入中文的问题
解决 QtCreator 3.5.1无法输入中文的问题
环境是ubuntu 15.10
ubuntu软件源中下载安装的fctix-libs-qt5
现在没有用,版本太旧了。
自己下载fctix-qt5
的源码来编译即可。
1、获取fctix-qt5源码
我没有找到fcitx-qt5
的git
仓库地址,只找到了源码包的下载地址。
先下载源码包,并解压。
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" (requested
version 1.4.0) with any of the following names:
ECMConfig.cmake
ecm-config.cmake
Add 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 a
separate 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" (requested
version 5.1.0) with any of the following names:
Qt5Config.cmake
qt5-config.cmake
Add 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 a
separate 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
版本过高的原因。
编译的时候可能会报错
make
YACC 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)无法输入中文的问题的更多相关文章
- 解决Qt程序在Linux下无法输入中文的办法
解决Qt程序在Linux下无法输入中文的办法 一位网友问我怎样在Linux的Qt的应用程序中输入中文,我一開始认为不是什么问题,可是后面自己尝试了一下还真不行.不仅是Qt制作的应用程序,就连Qt Cr ...
- 【Qt开发】解决Qt程序在Linux下无法输入中文的办法
解决Qt程序在Linux下无法输入中文的办法 一位网友问我如何在Linux的Qt的应用程序中输入中文,我一开始觉得不是什么问题,但是后面自己尝试了一下还真不行.不仅是Qt制作的应用程序,就连Qt Cr ...
- 解决Qt程序在Linux下无法输入中文的办法(与下文连接)
在安装QT集成开发工具包之前需要先安装build-essential和libncurses5-dev这两个开发工具和库,libncurses5-dev库是一个在Linux/Unix下广泛应用的图形函数 ...
- (转)解决Mac OS X上PhpStorm不能输入中文
看到Netbeans上类似问题的解决办法: /Applications/netbeans/NetBeans 6.7.1/Content/Resource/netbeans/etc/netbeans.c ...
- 解决Ubuntu下Sublime Text 3无法输入中文
前言 sublime很好用,但是ubuntu下不能输入中文,这是一个很大的问题.不知道为什么开发着一直也不解决,好在还是有高手在,总能找到方法.网上方法很多,但是也很乱,现在我将自己的经验总结一下. ...
- CentOS6.2下Qt5.1.0无法输入中文
因为在程序中需要在界面上输入中文,但是系统是英文系统,没有预装中文输入法,于是从网上搜了一下输入法的安装,但是输入法安装好之后,可以再系统中输入中文,但是却无法再Qt中输入中文,只能继续找解决办法 安 ...
- Ubuntu菜鸟入门(十八)————解决Ubuntu下Sublime Text 3无法输入中文
一.下载我们需要的文件,打开终端,输入: git clone https://github.com/lyfeyaj/sublime-text-imfix.git 二.将subl移动到/usr/bin/ ...
- Cocos2dx3.0 TextField 输入中文的问题
一开始无法输入中文, 显示出来的是乱码, 修改一个函数, 下面是修改过后的代码 void GLView::onGLFWCharCallback(GLFWwindow *window, unsigned ...
- 解决在ubuntu环境下, sublime不能输入中文的问题
sublime text很好用,但是ubuntu下不能输入中文,这是一个很大的问题.网上已经有很多方法,这里将我自己使用的方法记录总结一下 首先,将你的操作系统升级到最新版: sudo apt-get ...
随机推荐
- javaWeb加载Properties文件
public static Properties loadProps(String fileName) { Properties props = null; InputStream is = null ...
- js数组特定位置元素置空,非null和undefined,实现echarts现状图效果;谷歌格式化压缩js代码
一.想要实现eCharts线状图表的断点效果,如图(后来又查到数据格式为data:['-', 2, 3,'-' , 5, 6, 7]:也可以断点显示) 这种效果,在设置数据的时候应该是这样: data ...
- asp+mysql__不同类型用户登录
未防注入//0.0 /***这里代码应用场景为多类用户登录,根据用户选择不同的单选按钮判断用户登录的类型,*从而进行不同的数据表进行判断,用户的用户名和密码是否正确.*/ public partial ...
- Javascript的匿名函数与自执行
1.匿名函数 函数是JavaScript中最灵活的一种对象,这里只是讲解其匿名函数的用途.匿名函数:就是没有函数名的函数. 1.1 函数的定义,首先简单介绍一下函数的定义,大致可分为三种方式 第一种: ...
- Saltstack常用模块及API
Saltstack提供了非常丰富的功能模块,涉及操作系统的基础功能.常用工具支持等,更多模块信息可以查看官网模块介绍.也可以通过sys模块列出当前版本支持的模块. salt '*' sys.list_ ...
- 在Razor中如何引入命名空间?("import namespace in razor view") 【转】
原文链接 找了半天,原来如此: 在aspx中: <%@ Import Namespace = "Martian.Areas.SFC.Models" %><%@ I ...
- 【8-20】java学习笔记02
others 初始化块在构造器前执行: 静态初始化块和实例变量显示初始化执行顺序为各自定义的位置: final类不能派生子类,final方法不可覆盖,final变量不可重新赋值: 判定值相等,Stri ...
- c# 日期函数[string.Format----GetDateTimeFormats]格式 .【转帖备查】
DateTime dt = DateTime.Now;Label1.Text = dt.ToString();//2005-11-5 13:21:25Label2.Text = dt.ToFileTi ...
- Linux启动流程CentOS6
1.运行级别 0 关机 1 单用户模式,可以想象为Windows的安全模式,主要用与系统修复 2 不完全的命令行模式,不含NFS服务 3 完全的命令行模式,就是标准字符界面 4 系统保留 5 图像模式 ...
- CF464A (模拟)
http://codeforces.com/contest/465/problem/C Codeforces Round #265 (Div. 2) C Codeforces Round #265 ( ...