我的交叉编译环境是IMX6Q
交叉编译工具链搭建完毕
Step 1: 确保 /usr/lib/fonts/wqy-microhei.ttc 这个目录下有可用的中文字库
链接: https://pan.baidu.com/s/1VrEJwGst_4Uyvw1Jx8wtUw 提取码: cfvu 复制这段内容后打开百度网盘手机App,操作更方便哦
Step 2: 下载 googlepinyin QT库
https://github.com/tgtsml/QtInputMethod_GooglePinyin
Step 3: 严格按照流程编译运行
## 文件夹说明
### googlepinyin
Google拼音核心源码
### plugin
输入法插件源码
## 编译说明(以release版本为例)
选择release版本
1. 先编译googlepinyin源码, 再编译plugin源码
编译plugin, 错误 : /usr/bin/ld: cannot find -lgooglepinyin
拷贝编译出来的
build-........../plugin/googlepinyin/libgooglepinyin.a 到
....../QtInputMethod_GooglePinyin-master/plugin/googlepinyin/libgooglepinyin.a
编译通过!
2. 把编译好的库文件libgooglepinyin.a放到可执行文件 plugin/googlepinyin目录下;
3. 再编译plugin源码,把编译生成的target文件夹下的的库文件放到测试程序执行文件所在目录下的platforminputcontexts文件夹下;
libtgtsmlInputContextPlugin.so
libtgtsmlInputContextPlugin.so.1.0
libtgtsmlInputContextPlugin.so.1
libtgtsmlInputContextPlugin.so.1.0.0
4. 复制源码plugin目录下的dict目录到测试程序执行文件所在目录下;
5. 添加库googlepinyin库
.pro 文件添加库
LIBS += -L$$PWD/plugin/googlepinyin/ -lgooglepinyin;
int main(int argc, char *argv[])
{
qputenv("QT_IM_MODULE", "tgtsml"); // 注意这句话
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}
6.直接运行,点击输入框即可自动弹出googlepinyin输入框;