From 14506b18b279d9a79abf45ff034621c260fe18cd Mon Sep 17 00:00:00 2001 From: RigoLigo Date: Thu, 7 Apr 2022 05:37:09 +0000 Subject: [PATCH] =?UTF-8?q?=E5=B0=9D=E8=AF=95=E9=80=9A=E8=BF=87=E5=9C=A8ma?= =?UTF-8?q?in=E5=87=BD=E6=95=B0=E5=BC=BA=E8=A1=8C=E5=8A=A0=E5=85=A5?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E4=BF=AE=E5=A4=8D=E4=B8=80=E4=BA=9B=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 1231c55..613c22f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2,6 +2,7 @@ #include #include // Dtk::Widget::moveToCenter(&w); 要调用它,就得引用 DWidgetUtil +#include #include #include "widget.h" @@ -11,7 +12,12 @@ int main(int argc, char *argv[]) { DApplication::loadDXcbPlugin(); // 让 bar 处在标题栏中 DApplication::setAttribute(Qt::AA_EnableHighDpiScaling); // 开启 Hidpi 支持 - DApplication a(argc, argv); + // 程序内强制添加"-platformtheme deepin"参数喂给Qt让Qt正确使用Deepin主题修复各种奇怪样式问题 + QVector fakeArgs(argc + 2); + fakeArgs[0] = "-platformtheme"; + fakeArgs[1] = "deepin"; + for(int i = 0; i < argc; i++) fakeArgs[i + 2] = argv[i]; + DApplication a(argc + 2, fakeArgs.data()); a.setAttribute(Qt::AA_UseHighDpiPixmaps); a.loadTranslator(); // 载入翻译