diff --git a/src/main.cpp b/src/main.cpp index d3bee24..84bce65 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -141,14 +141,17 @@ int main(int argc, char *argv[]) // 龙芯机器配置,使得 DApplication 能正确加载 QtWebEngine qputenv("DTK_FORCE_RASTER_WIDGETS", "FALSE"); + // 设置 QtWebEngine 环境变量 + QStringList chromium_flags; // 浏览器开启 GPU 支持 - // qputenv("QTWEBENGINE_CHROMIUM_FLAGS", "--disable-features=UseModernMediaControls"); - // qputenv("QTWEBENGINE_CHROMIUM_FLAGS", "--disable-web-security"); + // chromium_flags.append("--disable-features=UseModernMediaControls"); + // chromium_flags.append("--disable-web-security"); // 全平台软件渲染Webkit - qputenv("QTWEBENGINE_CHROMIUM_FLAGS", "--disable-gpu"); -#if defined (__sw_64__) || defined (__loongarch__) - qputenv("QTWEBENGINE_CHROMIUM_FLAGS", "--no-sandbox"); + chromium_flags.append("--disable-gpu"); +#if defined __sw_64__ || __loongarch__ + chromium_flags.append("--no-sandbox"); #endif + qputenv("QTWEBENGINE_CHROMIUM_FLAGS", chromium_flags.join(" ").toUtf8()); /** * NOTE: https://zhuanlan.zhihu.com/p/550285855 diff --git a/src/utils/utils.cpp b/src/utils/utils.cpp index a3aa560..7d27054 100644 --- a/src/utils/utils.cpp +++ b/src/utils/utils.cpp @@ -198,7 +198,7 @@ void Utils::setQPAPlatform() // } else { - qputenv("QT_QPA_PLATFORM", "dxcb"); + qputenv("QT_QPA_PLATFORM", "dxcb;xcb"); } }