From f40fb71380b2175a4ad8af4ebd44b908910e15ab Mon Sep 17 00:00:00 2001 From: gongheng Date: Mon, 21 Apr 2025 15:30:26 +0800 Subject: [PATCH] fix: [Font-size] The Font size can not change by dde-control-center. -- Dtk enables the font size of upper-layer applications to change with the control center through DApplication. -- The desktop program has embedded dde-shell, but dde-shell uses QApplication, causing the font size of upper-layer applications not to follow changes when the control center's font size is adjusted. -- Modify dde-shell's QApplication to DApplication. Log: fix issue Bug: https://pms.uniontech.com/bug-view-285621.html --- shell/CMakeLists.txt | 2 ++ shell/main.cpp | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/shell/CMakeLists.txt b/shell/CMakeLists.txt index 7b7084118..a74b97467 100644 --- a/shell/CMakeLists.txt +++ b/shell/CMakeLists.txt @@ -2,6 +2,7 @@ # # SPDX-License-Identifier: CC0-1.0 +find_package(Dtk${DTK_VERSION_MAJOR} COMPONENTS Widget REQUIRED) find_package(Qt${QT_VERSION_MAJOR} ${REQUIRED_QT_VERSION} REQUIRED COMPONENTS Widgets Gui WaylandClient) find_package(TreelandProtocols REQUIRED) pkg_check_modules(WaylandClient REQUIRED IMPORTED_TARGET wayland-client) @@ -41,6 +42,7 @@ target_link_libraries(dde-shell PRIVATE Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::WaylandClient Dtk${DTK_VERSION_MAJOR}::Gui + Dtk${DTK_VERSION_MAJOR}::Widget Qt${QT_VERSION_MAJOR}::DBus PkgConfig::WaylandClient ) diff --git a/shell/main.cpp b/shell/main.cpp index 908590da7..e02b41cbd 100644 --- a/shell/main.cpp +++ b/shell/main.cpp @@ -7,6 +7,7 @@ #include #include +#include #include #include #include @@ -24,6 +25,7 @@ DS_USE_NAMESPACE DGUI_USE_NAMESPACE +DWIDGET_USE_NAMESPACE DS_BEGIN_NAMESPACE Q_DECLARE_LOGGING_CATEGORY(dsLog) @@ -95,7 +97,7 @@ int main(int argc, char *argv[]) { setenv("DSG_APP_ID", "org.deepin.dde.shell", 0); DGuiApplicationHelper::setAttribute(DGuiApplicationHelper::UseInactiveColorGroup, false); - QApplication a(argc, argv); + DApplication a(argc, argv); // Don't apply to plugins qunsetenv("QT_SCALE_FACTOR"); // dde-shell contains UI controls based on QML and Widget technologies.