[software development] QtCreator 10.x 11.x 中 fcitx 输入法解决方案
Tofloor
poster avatar
魔法师
deepin
2023-10-10 02:33
Author

概要

AI: 在现代化的编程开发中,选用一个优秀的集成开发环境是至关重要的。然而,在实际应用中,我们难免会遇到一些问题。例如,QtCreator 10.x 是一个广受欢迎的开发工具,但可能存在一些缺陷,如无法在其中使用 fcitx 等输入法,在某些情况下会给开发带来不便。如果您没有编译过 fcitx 等工具,解决这类问题也会变得更加困难。因此,在编程开发过程中,及时解决这些问题并选用适合自己的工具,是重要的一步。

系统平台与编译准备初期

image.png
安装 qt6-base-private-dev 包,以及 fcitx-libs-dev,如果你安装了 fcitx5 可能会出现一点冲突,总之你卸载了 fcitx5 在之后重新安装一下就行了。

中期的编译准备

  1. 你需要拿到 fcitx-qt5 的源代码,debian 系列可执行 apt source fcitx-qt5
    image.png

  2. 你需要安装所有参与编译 fcitx-qt5 的支持包,这里是因为我安装了 fcitx5

    image.png

  3. 卸载了 fcitx5 就可以继续了

    image.png

最后开始编译

  1. 修改 fcitx-qt5 源代码,只产 qt6 的 Qt Plugin 模块

    image.png

  2. 直接编译,我的 fcitx-qt5 的 so 就生成出来了

    image.png

编译结束后的部署

  1. 复制到 Qt Creator 10.x 系列所有类似目录

复制到了下面的 QtCreator 11 这里
image.png

  1. 然后就能使用了

    image.png

  2. 一堆 qtcreator

    image.png

图末后继,安装 fcitx5

image.png


这是我的CSDN博客,当然这没有什么技术性的东西

Reply Favorite View the author
All Replies
魔法师
deepin
2023-10-10 02:36
#1

前排操作,我的沙发我来坐agree

Reply View the author
WangZhongyun
deepin
2023-10-10 02:50
#2

又前进一步了。生态越来越繁盛。

Reply View the author
阿尼樱奈奈
Moderator
2023-10-10 02:58
#3

like

Reply View the author
jjcui8595
Moderator
2023-10-10 03:06
#4

楼主威武

Reply View the author
忘记、过去
Moderator
2023-10-10 03:43
#5

后排膜一下大佬 smirk

Reply View the author
bluesky_
deepin
2023-10-10 16:48
#6

1.安装依赖

sudo apt install git cmake extra-cmake-modules gcc g++ libxkbcommon-dev

2.复制源码

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

3.进入目录

cd fcitx-qt5

4.修改CMakeLists.txt

# 要支持哪个就打开哪个,我这里编译Qt6的输入支持模块
option(ENABLE_QT5 "Enable Qt5" Off)
option(ENABLE_QT6 "Enable Qt6 im module" On)
option(ENABLE_LIBRARY "Qt library" Off)

5.开始编译

# 在编译前要先指定qt目录
# 在编译前导入qt所在目录 
#在终端输入命令导入你的qt6路径  export PATH=/opt/apps/Qt/6.3.1/gcc_64/bin:$PATH
# 这是我的qt安装目录,要根据自己情况修改
mkdir build && cd build
cmake .. -DENABLE_LIBRARY=false
make -j12

6.得到动态库文件

cd qt6/platforminputcontext
ls | grep *.so

如果一切正常会出现一个.so结尾的动态库文件

7.将动态库丢入要支持fcitx输入法的qt程序的插件目录中

# 举例
sudo cp libfcitxplatforminputcontextplugin-qt6.so /opt/apps/Qt/Tools/QtCreator/lib/Qt/plugins/platforminputcontexts
Reply View the author
bluesky_
deepin
2023-10-10 16:49
#7
bluesky_

1.安装依赖

sudo apt install git cmake extra-cmake-modules gcc g++ libxkbcommon-dev

2.复制源码

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

3.进入目录

cd fcitx-qt5

4.修改CMakeLists.txt

# 要支持哪个就打开哪个,我这里编译Qt6的输入支持模块
option(ENABLE_QT5 "Enable Qt5" Off)
option(ENABLE_QT6 "Enable Qt6 im module" On)
option(ENABLE_LIBRARY "Qt library" Off)

5.开始编译

# 在编译前要先指定qt目录
# 在编译前导入qt所在目录 
#在终端输入命令导入你的qt6路径  export PATH=/opt/apps/Qt/6.3.1/gcc_64/bin:$PATH
# 这是我的qt安装目录,要根据自己情况修改
mkdir build && cd build
cmake .. -DENABLE_LIBRARY=false
make -j12

6.得到动态库文件

cd qt6/platforminputcontext
ls | grep *.so

如果一切正常会出现一个.so结尾的动态库文件

7.将动态库丢入要支持fcitx输入法的qt程序的插件目录中

# 举例
sudo cp libfcitxplatforminputcontextplugin-qt6.so /opt/apps/Qt/Tools/QtCreator/lib/Qt/plugins/platforminputcontexts

这样做可以不需要卸载fcitx5

Reply View the author
dgmenghuan
deepin
2023-10-10 17:06
#8

高手太多了,学习了

Reply View the author
卖了摩托继续写Bug
deepin
2023-10-10 18:04
#9

厉害厉害,终于搞定了 qtcreator 中输入法的问题!kissing_heart

Reply View the author
蓝鲸
deepin
2023-10-17 00:15
#10

高手kissing_heart

Reply View the author
魔法师
deepin
2023-10-19 06:34
#11

blush

Reply View the author
见路不走
deepin
2023-10-21 15:53
#12

厉害了

ok

Reply View the author
随心
deepin
2023-11-30 16:03
#13

搞个能在deepinv23安装使用的搜狗或者Ai百度输入法,高人们👍

Reply View the author