[Seek Help] [Qt]使用QLineEdit无法通过键盘输入中文,请问有大佬知道吗? Resolved
Tofloor
poster avatar
melon_o
deepin
2022-10-09 21:54
Author

截图_选择区域_20221009135337.png

Reply Favorite View the author
All Replies
寂静的羽夏
deepin
2022-10-09 23:03
#1

如果你是默认创建 QLineEdit 的话,不应该啊,我使用 QT 开发有小半年了,没遇到啊。除非你用代码限制了输入法模式。如果没有动,检查一下你的输入法是否正常。

Reply View the author
忘记、过去
deepin
2022-10-09 23:16
#2

如果是从仓库装的 Qt 环境,系统里是有 fcitx 的输入法插件的,好像没啥问题。自己从官网安装的 Qt 可能需要检查下?

/usr/lib/x86_64-linux-gnu/qt5/plugins/platforminputcontexts/libfcitxplatforminputcontextplugin.so

默认的插件位置在这里

Reply View the author
melon_o
deepin
2022-10-10 00:10
#3
忘记、过去

如果是从仓库装的 Qt 环境,系统里是有 fcitx 的输入法插件的,好像没啥问题。自己从官网安装的 Qt 可能需要检查下?

/usr/lib/x86_64-linux-gnu/qt5/plugins/platforminputcontexts/libfcitxplatforminputcontextplugin.so

默认的插件位置在这里

这个我配置过了,在编写代码那里可以输入中文,但是运行程序,控件就没法输入中文了

Reply View the author
melon_o
deepin
2022-10-10 00:11
#4
寂静的羽夏

如果你是默认创建 QLineEdit 的话,不应该啊,我使用 QT 开发有小半年了,没遇到啊。除非你用代码限制了输入法模式。如果没有动,检查一下你的输入法是否正常。

我用的搜狗输入法,在编写代码那里可以输入中文,但是运行程序,控件就没法输入中文了

Reply View the author
忘记、过去
deepin
2022-10-10 00:26
#5
melon_o

这个我配置过了,在编写代码那里可以输入中文,但是运行程序,控件就没法输入中文了

export XMODIFIERS="@im=fcitx"   
export GTK_IM_MODULE="fcitx"     
export QT_IM_MODULE="fcitx"

看看运行时环境变量设置?

截图_qtcreator_20221009162535.png

Reply View the author
melon_o
deepin
2022-10-10 00:36
#6
忘记、过去
export XMODIFIERS="@im=fcitx"   
export GTK_IM_MODULE="fcitx"     
export QT_IM_MODULE="fcitx"

看看运行时环境变量设置?

截图_qtcreator_20221009162535.png

截图_选择区域_20221009163518.png

Reply View the author
忘记、过去
deepin
2022-10-10 00:48
#7
melon_o

截图_选择区域_20221009163518.png

截图里的 LD_LIBRARY_PATH 环境变量的地址下面有 fcitx 输入法插件吗?

Reply View the author
melon_o
deepin
2022-10-10 00:57
#8
忘记、过去

截图里的 LD_LIBRARY_PATH 环境变量的地址下面有 fcitx 输入法插件吗?

没有,我放进去重启电脑后还是不行...

截图_选择区域_20221009165553.png

Reply View the author
忘记、过去
deepin
2022-10-10 01:26
#9
melon_o

没有,我放进去重启电脑后还是不行...

截图_选择区域_20221009165553.png

在 /opt/Qt5.12.12/5.12.12/gcc_64/lib 文件夹下面逐级建立 qt5/plugins/platforminputcontexts 文件夹,插件放在这里再试试?

Reply View the author
melon_o
deepin
2022-10-10 02:26
#10
忘记、过去

在 /opt/Qt5.12.12/5.12.12/gcc_64/lib 文件夹下面逐级建立 qt5/plugins/platforminputcontexts 文件夹,插件放在这里再试试?

还是不行...

截图_选择区域_20221009170520.png

Reply View the author
忘记、过去
deepin
2022-10-10 05:24
#11
melon_o

还是不行...

截图_选择区域_20221009170520.png

sob 那就真不知道了......坐等大佬来解决

Reply View the author
melon_o
deepin
2022-10-10 16:41
#12
忘记、过去

sob 那就真不知道了......坐等大佬来解决

请问下,你的qt是哪个版本呢?

Reply View the author
忘记、过去
deepin
2022-10-10 17:19
#13
melon_o

请问下,你的qt是哪个版本呢?

系统仓库的版本,UOS 5.11.3,Deepin 5.15.X

Reply View the author
melon_o
deepin
2022-10-10 19:21
#14
忘记、过去

系统仓库的版本,UOS 5.11.3,Deepin 5.15.X

卸载了,使用命令安装就可以了,使用官方的包不知道为什么存在这个bugsob

Reply View the author