From f432cc00db42af5394c206b4b08f98e39c4f28b9 Mon Sep 17 00:00:00 2001 From: pimin <362371171@qq.com> Date: Sun, 16 Nov 2025 16:54:32 +0800 Subject: [PATCH] modified dpi --- src/main.cpp | 11 +++++++++++ src/translations/Dyt_zh_CN.ts | 16 ++++++++-------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index e8e64d26..b274816e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -45,6 +45,17 @@ int main(int argc, char* argv[]) { app.setAttribute(Qt::AA_DontCreateNativeWidgetSiblings); InstallCrashHandler(); + //字体高分屏自适应 + const float DEFAULT_DPI = 96.0; + HDC screen = GetDC(NULL); + FLOAT dpiX = static_cast(GetDeviceCaps(screen, LOGPIXELSX)); + ReleaseDC(0, screen); + float fontSize = dpiX / DEFAULT_DPI; + + QFont font = app.font(); + font.setPointSize(font.pointSize()*fontSize); + app.setFont(font); + // Single-instance guard to avoid multiple launches from repeated clicks const QString lockPath = QStandardPaths::writableLocation(QStandardPaths::TempLocation) + "/Dyt_app.lock"; QLockFile lock(lockPath); diff --git a/src/translations/Dyt_zh_CN.ts b/src/translations/Dyt_zh_CN.ts index 9a3ab457..620c5767 100644 --- a/src/translations/Dyt_zh_CN.ts +++ b/src/translations/Dyt_zh_CN.ts @@ -2294,22 +2294,22 @@ - + model elements 模型元素 - + preset models 预制模型 - + attribte 属性 - + Main View 主视图 @@ -2552,7 +2552,7 @@ - + WorkSpace 工作区间 @@ -2855,17 +2855,17 @@ 路径 - + suffix 后缀 - + ModelBase 模型 - + color base 颜色