From 5fe1c298d2eb192fb5b5ebb142de9b3d53046874 Mon Sep 17 00:00:00 2001 From: gaozheng Date: Tue, 16 Jun 2026 18:48:29 +0800 Subject: [PATCH] =?UTF-8?q?fix(vtk):=20=E6=94=B9=E7=94=A8=20GDI=20?= =?UTF-8?q?=E5=AD=97=E4=BD=93=E5=BC=95=E6=93=8E=E7=BB=95=E5=BC=80=20Direct?= =?UTF-8?q?Write=20=E5=AD=97=E4=BD=93=E5=9B=9E=E9=80=80=E5=B4=A9=E6=BA=83(?= =?UTF-8?q?=E5=8B=BE=E9=80=89=E6=95=B0=E6=8D=AE=E9=9B=86=E6=B8=B2=E6=9F=93?= =?UTF-8?q?=E6=97=B6=20QPushButton=20sizeHint=20=E8=A7=A6=E5=8F=91,?= =?UTF-8?q?=E8=A7=81crash=20dump)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/main.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/app/main.cpp b/src/app/main.cpp index 555b750..3b26733 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -1251,6 +1251,14 @@ public: int main(int argc, char* argv[]) { +#ifdef Q_OS_WIN + // Qt6 Windows 的 DirectWrite 字体数据库在本机枚举字体回退(fallbacksForFamily → + // populateFamily)时崩溃(0xc0000005,见 logs/crash_*.dmp + geopro_*.log 栈):渲染后一次布局 + // 重算 QPushButton sizeHint → 对按钮文字整形 → 主字体(YaHei)缺某字形(如三角符 ◀▶)触发回退 → + // DirectWrite 在本机抛 C++ 异常并最终段错误(登录/面板只用中文+拉丁,YaHei 都有,故先前不崩)。 + // 改用 GDI 字体引擎绕开有问题的 DirectWrite 回退路径(稳定优先,渲染质量略变)。须在 QApplication 前设置。 + qputenv("QT_QPA_PLATFORM", "windows:fontengine=gdi"); +#endif // Qt WebEngine(地图页签的 QWebEngineView):必须在 QApplication 构造前初始化, // 且需启用跨上下文共享 OpenGL(QtWebEngine 与 QVTK 同进程共用 GL context,避免黑屏/崩溃)。 // AA_ShareOpenGLContexts 须在 QApplication 之前设置;QtWebEngineQuick::initialize() 同样须前置。