admin管理员组文章数量:1130349
- 根据搜狗官网安装搜狗输入法
https://shurufa.sogou/linux/guide
- 安装必要的库
sudo apt install cmake make fcitx-libs-dev libgl1-mesa-dev libglu1-mesa-dev libxkbcommon-dev
- 在系统输入法设置那里,选择fcitx,并设置为全局有效。
- 设置环境变量
sudo vim ~/.bashrc
//在文件最后添加
export CLUTTER_IM_MODULE=“xim”
export GTK_IM_MODULE=“fcitx”
export IM_CONFIG_PHASE=“2”
export LC_TIME=“zh_CN.UTF-8”
export QT4_IM_MODULE=“fcitx”
export QT_IM_MODULE=“fcitx”
export XDG_RUNTIME_DIR=“/run/user/1000”
export XMODIFIERS=“@im=fcitx”
//最后运行下面代码使其生效
Source ~/.bashrc
- 下载fcitx-qt5源码
git clone https://github/fcitx/fcitx-qt5.git
//可能会下载失败,直接官网下载,然后复制到Ubuntu中
https://github/fcitx/fcitx-qt5
- 更改CMakeLists.txt文件
cd ~/fcitx-qt5-master //根据路径更改
sudo vim CMakeLists.txt
//更改qt版本进行更改,默认时qt5
option(ENABLE_QT5 "Enable Qt5" On)
option(ENABLE_QT6 "Enable Qt6 im module" Off)
- 声明cmake的路径
export CMAKE_PREFIX_PATH= ~/Qt5.14.2/5.14.2/gcc_64/ 你的安装路径
- 开始编译文件
mkdir build && cd build
cmake ../
make -j8
- 将编译好的动态库复制到qt安装目录下
//根据自己实际情况更改下面地址
sudo cp ~/fcitx-qt5-master/build/qt5/platforminputcontext/libfcitxplatforminputcontextplugin-qt5.so ~/Qt5.14.2/5.14.2/gcc_64/plugins/platforminputcontexts/
sudo cp ~/fcitx-qt5-master/build/qt5/platforminputcontext/libfcitxplatforminputcontextplugin-qt5.so ~/Qt5.14.2/Tools/QtCreator/lib/Qt/plugins/platforminputcontexts/
sudo chmod +x ~/Qt5.14.2/5.14.2/gcc_64/plugins/platforminputcontexts/libfcitxplatforminputcontextplugin-qt5.so
sudo chmod +x ~/Qt5.14.2/Tools/QtCreator/lib/Qt/plugins/platforminputcontexts/libfcitxplatforminputcontextplugin-qt5.so
- 重启qt就可以愉快的输入中文啦
参考:
1.https://blog.csdn/u012321968/article/details/106734330
2.https://blog.csdn/weixin_43548433/article/details/128428741
3.https://blog.csdn/m0_46144825/article/details/122462453
- 根据搜狗官网安装搜狗输入法
https://shurufa.sogou/linux/guide
- 安装必要的库
sudo apt install cmake make fcitx-libs-dev libgl1-mesa-dev libglu1-mesa-dev libxkbcommon-dev
- 在系统输入法设置那里,选择fcitx,并设置为全局有效。
- 设置环境变量
sudo vim ~/.bashrc
//在文件最后添加
export CLUTTER_IM_MODULE=“xim”
export GTK_IM_MODULE=“fcitx”
export IM_CONFIG_PHASE=“2”
export LC_TIME=“zh_CN.UTF-8”
export QT4_IM_MODULE=“fcitx”
export QT_IM_MODULE=“fcitx”
export XDG_RUNTIME_DIR=“/run/user/1000”
export XMODIFIERS=“@im=fcitx”
//最后运行下面代码使其生效
Source ~/.bashrc
- 下载fcitx-qt5源码
git clone https://github/fcitx/fcitx-qt5.git
//可能会下载失败,直接官网下载,然后复制到Ubuntu中
https://github/fcitx/fcitx-qt5
- 更改CMakeLists.txt文件
cd ~/fcitx-qt5-master //根据路径更改
sudo vim CMakeLists.txt
//更改qt版本进行更改,默认时qt5
option(ENABLE_QT5 "Enable Qt5" On)
option(ENABLE_QT6 "Enable Qt6 im module" Off)
- 声明cmake的路径
export CMAKE_PREFIX_PATH= ~/Qt5.14.2/5.14.2/gcc_64/ 你的安装路径
- 开始编译文件
mkdir build && cd build
cmake ../
make -j8
- 将编译好的动态库复制到qt安装目录下
//根据自己实际情况更改下面地址
sudo cp ~/fcitx-qt5-master/build/qt5/platforminputcontext/libfcitxplatforminputcontextplugin-qt5.so ~/Qt5.14.2/5.14.2/gcc_64/plugins/platforminputcontexts/
sudo cp ~/fcitx-qt5-master/build/qt5/platforminputcontext/libfcitxplatforminputcontextplugin-qt5.so ~/Qt5.14.2/Tools/QtCreator/lib/Qt/plugins/platforminputcontexts/
sudo chmod +x ~/Qt5.14.2/5.14.2/gcc_64/plugins/platforminputcontexts/libfcitxplatforminputcontextplugin-qt5.so
sudo chmod +x ~/Qt5.14.2/Tools/QtCreator/lib/Qt/plugins/platforminputcontexts/libfcitxplatforminputcontextplugin-qt5.so
- 重启qt就可以愉快的输入中文啦
参考:
1.https://blog.csdn/u012321968/article/details/106734330
2.https://blog.csdn/weixin_43548433/article/details/128428741
3.https://blog.csdn/m0_46144825/article/details/122462453
版权声明:本文标题:ubuntu下搜狗输入法支持QT输入中文(qt5和qt6均适用) 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/jiaocheng/1763950029a2974153.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论