From c7f4c2c0b80e91ff537703cd9ef6fd868bfcff2f Mon Sep 17 00:00:00 2001 From: majiuping Date: Mon, 9 Nov 2026 15:54:14 +0800 Subject: [PATCH] fix: enable high-DPI pixmaps so titlebar icons render sharply Under Wayland fractional scaling the window reports a device pixel ratio of 1.5, but Qt's icon painting path ignores it unless Qt::AA_UseHighDpiPixmaps is enabled. The SVG titlebar icon was therefore rasterized at 32x32 and scaled up to the 48x48 device pixels of its slot, which made it look aliased. Enable Qt::AA_EnableHighDpiScaling and Qt::AA_UseHighDpiPixmaps before constructing the application, so QIcon requests and rasterizes icons at the real device pixel ratio. Bug: https://pms.uniontech.com/bug-view-193447.html --- src/main.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index cb3ecad6..713cf29f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2022-2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -28,6 +29,8 @@ int main(int argc, char *argv[]) return 0; } + QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); + QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); DGuiApplicationHelper::setUseInactiveColorGroup(false); #if(DTK_VERSION < DTK_VERSION_CHECK(5,4,0,0)) DApplication::loadDXcbPlugin();