Files
Misaki 5be7f7f04b feat: implement AI schedule app with multi-device sync
- Qt 6 desktop client with day/month/year views, AI scheduling, and TOML settings\n- Go sync server with SQLite change stream, WebSocket notifications, and Docker deployment\n- Client outbox/LWW sync, offline retry, and dual-client integration tests\n- Linux fcitx5 setup, validation reports, and Windows MinGW preset
2026-10-26 13:58:45 +08:00

97 lines
2.8 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Linux 中文输入法(fcitx5)修复验证
> 日期:2026-10-26
> 环境:Ubuntu 24.04 / X11 / fcitx5 / 自定义 Qt 6.6.3 (`/home/misaki/Qt6.3/6.6.3/gcc_64`)
## 1. 问题
在紧凑窗口的 AI 输入框、设置页字段等 `QLineEdit` 派生控件中无法输入中文。
`ElaLineEdit` 继承 `QLineEdit`,没有拦截输入法事件;问题不在控件代码,而在 Qt 的 platform input context 插件。
## 2. 诊断
环境:
```text
QT_IM_MODULE=fcitx
XMODIFIERS=@im=fcitx
fcitx5 正在运行
```
系统包 `fcitx5-frontend-qt6` 的插件安装于:
```text
/usr/lib/x86_64-linux-gnu/qt6/plugins/platforminputcontexts/libfcitx5platforminputcontextplugin.so
```
但它是针对发行版 Qt 6.4 编译的。用 `QT_DEBUG_PLUGINS=1` 启动本项目时:
```text
cannot load ... libfcitx5platforminputcontextplugin.so:
undefined symbol: _ZN22QWindowSystemInterface22handleExtendedKeyEvent...
version Qt_6_PRIVATE_API
```
自定义 Qt 6.6.3 的插件目录中也缺少 fcitx5 插件,因此 Qt 回退到 compose/无输入法上下文。
## 3. 修复
使用 `scripts/setup-fcitx5-qt6-plugin.sh`:
1. 下载 `fcitx5-qt` v5.1.4 与 `extra-cmake-modules`(构建期依赖);
2. 以 `BUILD_ONLY_PLUGIN=ON`、`ENABLE_QT6=ON` 针对项目使用的 Qt 6.6.3 重新编译;
3. 安装到 `$QT_ROOT/plugins/platforminputcontexts/`;
4. 重启应用。
已在本机执行:
```bash
./scripts/setup-fcitx5-qt6-plugin.sh
```
安装后的插件:
```text
/home/misaki/Qt6.3/6.6.3/gcc_64/plugins/platforminputcontexts/libfcitx5platforminputcontextplugin.so
```
## 4. 加载验证
```bash
QT_DEBUG_PLUGINS=1 ./build/linux-gcc/bin/Schedule 2>&1 | grep -i fcitx
```
输出包含:
```text
Got keys from plugin meta data QList("fcitx", "fcitx5")
loaded library ".../libfcitx5platforminputcontextplugin.so"
```
说明 Qt 已加载正确版本的 fcitx5 输入法插件。
进一步在应用运行时执行 `fcitx5-diagnose`,可以看到 Schedule 已注册输入上下文:
```text
IC [....] program:Schedule frontend:dbus cap:16000800072 focus:1
```
这表示 fcitx5 已接管该应用的输入上下文;实际中文上屏请在重启应用后的输入框中确认。
## 5. 平台说明
- Linux/X11:需要上述 fcitx5 Qt6 插件;使用自定义 Qt 时必须针对该 Qt 重新编译。
- Linux/Wayland:fcitx5-qt 还提供 Wayland workaround;当前脚本按 X11 环境构建,Wayland 下如遇问题可启用该选项后重建。
- Windows/macOS:Qt 原生输入法支持,`QLineEdit` 可直接使用系统中文输入法,不需要该插件。
## 6. 待人工确认
重启应用后,请在以下位置测试中文输入:
1. 紧凑窗口 AI 输入框;
2. 详细日程 → 新建/编辑日程的标题字段;
3. 设置 → AI 服务字段。
如果仍无法输入,请提供 `QT_DEBUG_PLUGINS=1` 日志以及 `fcitx5-diagnose` 的相关输出。