ARM Linux Qt Widget 虚拟键盘输入法移植

文章目录

1、环境介绍

Qt 源码版本:Qt5.15.9(Widget)

硬件:T113(buildroot)

2、前言

本次是给一个嵌入式 ARM Linux 项目移植一个开源的虚拟键盘,该项目使用的屏幕分辨率为 1424*280,需要修改键盘的位置与大小。最终决定移植该键盘:https://gitee.com/smartwell/QtInputMethod_GooglePinyin

3、下载源码

shell 复制代码
git clone https://gitee.com/smartwell/QtInputMethod_GooglePinyin.git

4、编译源码

shell 复制代码
cd QtInputMethod_GooglePinyin
<your_path>/qmake
make
make install

5、移植

  1. 将编译出的动态库文件 QtInputMethod_GooglePinyin/target/libtgtsmlInputContextPlugin.so.1.0.0 复制到自己板卡的<your_qt>/plugins/platforminputcontexts/目录下,并重名为 libtgtsmlInputContextPlugin.so
shell 复制代码
# 动态库文件位置:QtInputMethod_GooglePinyin/target/libtgtsmlInputContextPlugin.so.1.0.0
# 我板卡的位置:/usr/local/Qt-5.15.9/plugins/platforminputcontexts/
cp QtInputMethod_GooglePinyin/target/libtgtsmlInputContextPlugin.so.1.0.0 /usr/local/Qt-5.15.9/plugins/platforminputcontexts/libtgtsmlInputContextPlugin.so
  1. 复制 QtInputMethod_GooglePinyin/plugin/dict 目录到板卡,和你的 qt 可执行程序放在同一路径:
shell 复制代码
cp QtInputMethod_GooglePinyin/plugin/dict <your_board>

6、设置环境变量

程序运行前,需设置如下环境变量:

shell 复制代码
export QT_IM_MODULE=tgtsml

至此,虚拟键盘移植结束。运行程序后,点击文本框就会自动弹出键盘了。但是键盘的弹出位置默认在文本框的上方,以及键盘有点大,下文将介绍如何修改。

7、调整键盘位置与大小

  1. 修改大小:QtInputMethod_GooglePinyin/plugin/keyboardform.cpp
  1. 修改键盘显示位置:QtInputMethod_GooglePinyin/plugin/tgtsmlplatforminputcontext.cpp

修改后,重新编译移植。

8、结果展示

运行 qt 程序,点击输入文本框,会自动调起虚拟键盘。

9、参考文章

无。

10、总结

略。

相关推荐
chlk1236 小时前
Linux文件权限完全图解:读懂 ls -l 和 chmod 755 背后的秘密
linux·操作系统
舒一笑6 小时前
Ubuntu系统安装CodeX出现问题
linux·后端
改一下配置文件7 小时前
Ubuntu24.04安装NVIDIA驱动完整指南(含Secure Boot解决方案)
linux
深紫色的三北六号17 小时前
Linux 服务器磁盘扩容与目录迁移:rsync + bind mount 实现服务无感迁移(无需修改配置)
linux·扩容·服务迁移
SudosuBash21 小时前
[CS:APP 3e] 关于对 第 12 章 读/写者的一点思考和题解 (作业 12.19,12.20,12.21)
linux·并发·操作系统(os)
哈基咪怎么可能是AI1 天前
为什么我就想要「线性历史 + Signed Commits」GitHub 却把我当猴耍 🤬🎙️
linux·github
十日十行2 天前
Linux和window共享文件夹
linux
木心月转码ing2 天前
WSL+Cpp开发环境配置
linux
崔小汤呀3 天前
最全的docker安装笔记,包含CentOS和Ubuntu
linux·后端
何中应3 天前
vi编辑器使用
linux·后端·操作系统