一、问题描述:
centos stream9 安装了多个 qt creator 版本 Qt5.14.1 、qt creator 9.0、 qt creator 6.0 在调试platforminputcontexts 解决中文无法输入时,在修改/etc/profile
#export QT_PLUGIN_PATH=/opt/Qt5.14.1/5.14.1/gcc_64/plugins/platforminputcontexts:$QT_PLUGIN_PATH
export QT_PLUGIN_PATH=/home/dltc/sdk/qt-everywhere-src-6.3.0/qtbase/plugins:$QT_PLUGIN_PATH
#export QT_PLUGIN_PATH=/home/dltc/sdk/qt-everywhere-src-6.3.0/qtbase/plugins/platforminputcontexts:$QT_PLUGIN_PATH
修改以下配置参数据突然导致 qt creator 9.0 无法启动,后来命令命令启动发现如下错误:
直接快捷方式无法启动,我们找到 /opt/qtcreator-9.0.0/bin
直接使用命令启动,以观察其报错信息
[root@localhost bin]# ./qtcreator.sh
Warning: Ignoring WAYLAND_DISPLAY on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
Cannot mix incompatible Qt library (6.3.0) with this library (6.4.1)
已放弃 (核心已转储)
[root@localhost bin]#
二、分析过程
经过仔细分析shell 命令 export 及 $PATH 语法 及冒号:语法
得出:冒号主要是间隔作用,变量定义直接用命令,变量调用使用$+名称
如定义 PATH=a/b/c
如调用 $PATH
但是 PATH=a/bc/$PATH 是什么意思?
大概意思是是PATH中现有地址和新地址累加以冒号间隔,程序导址时,从这两个或多个地址中分别查找
三、解决
#export QT_PLUGIN_PATH=/opt/Qt5.14.1/5.14.1/gcc_64/plugins/platforminputcontexts:$QT_PLUGIN_PATH
export QT_PLUGIN_PATH=/home/dltc/sdk/qt-everywhere-src-6.3.0/qtbase/plugins:$QT_PLUGIN_PATH
#export QT_PLUGIN_PATH=/home/dltc/sdk/qt-everywhere-src-6.3.0/qtbase/plugins/platforminputcontexts:$QT_PLUGIN_PATH
我把/etc/profile 修改为 export QT_PLUGIN_PATH=/home/dltc/sdk/qt-everywhere-src-6.3.0/qtbase/plugins:$QT_PLUGIN_PATH
然后用source profile 重启电脑,qt creator 9.0 依然不行
接下来仔细观察发现相对第一个少了一个platforminputcontexts,没想到指到上一经竟然不行
那么修改为:
export QT_PLUGIN_PATH=/home/dltc/sdk/qt-everywhere-src-6.3.0/qtbase/plugins/platforminputcontexts:$QT_PLUGIN_PATH
#export QT_PLUGIN_PATH=/opt/Qt5.14.1/5.14.1/gcc_64/plugins/platforminputcontexts:$QT_PLUGIN_PATH
#export QT_PLUGIN_PATH=/home/dltc/sdk/qt-everywhere-src-6.3.0/qtbase/plugins:$QT_PLUGIN_PATH
export QT_PLUGIN_PATH=/home/dltc/sdk/qt-everywhere-src-6.3.0/qtbase/plugins/platforminputcontexts:$QT_PLUGIN_PATH
source profile 然后重启 竟然好了
qt creator 9.0直接启动起来了
不知道 为什么只source profile不起作用,只有重启再起作用,会不会有缓存的问题
不过至此为exprot 冒号分隔 还有 ,多版本qt creator 启动时寻址有了一些积累,还不是太精通,继续学习中 .....
后续:
启动我的ibusdemo2 切换输入法发现 自己修改的ibus platforminputcontexts 相关代码的日志有了反应
调用了qibuplatforminputcontext-dltc
意外之喜,终于打开发,解决centos stream9 qt 无法输入中文的调试之路,只有修改和编译的代码
在系统上有反应,我们就可以找出centos steam9 上 qt 为什么无法输入中文的原因,进而找到解决办法