From b73fa4933310ed6c67f1d53b14b21acfeb01b05f Mon Sep 17 00:00:00 2001 From: wjyrich Date: Wed, 26 Nov 2025 15:41:51 +0800 Subject: [PATCH] fix: disable theme icon loading for battery display MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removed the code that attempts to load battery icons from system theme and now directly uses the built-in SVG icons. This change was necessary because the plugin currently does not support theme changes, and the theme icon loading was causing inconsistent battery icon display. The fallback mechanism now becomes the primary method for loading battery icons. Log: Fixed inconsistent battery icon display in dock Influence: 1. Verify battery icons display correctly in different states (charging, low battery, etc.) 2. Test battery percentage changes and corresponding icon updates 3. Check that all battery level icons are properly rendered 4. Verify no missing or broken battery icons in dock 5. Test with different battery levels and charging states fix: 禁用主题图标加载,使用内置电池图标 移除了从系统主题加载电池图标的代码,现在直接使用内置的SVG图标。此变更是 必要的,因为插件目前不支持主题变化,主题图标加载会导致电池图标显示不一 致。后备机制现在成为加载电池图标的主要方法。 Log: 修复了dock中电池图标显示不一致的问题 Influence: 1. 验证不同状态下的电池图标显示正确(充电、低电量等) 2. 测试电池百分比变化及对应的图标更新 3. 检查所有电池电量图标是否正确渲染 4. 验证dock中没有缺失或损坏的电池图标 5. 测试不同电量水平和充电状态下的显示 PMS: BUG-342033 --- plugins/dde-dock/power/powerapplet.cpp | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/plugins/dde-dock/power/powerapplet.cpp b/plugins/dde-dock/power/powerapplet.cpp index 15e3ff3b0..ab41f3230 100644 --- a/plugins/dde-dock/power/powerapplet.cpp +++ b/plugins/dde-dock/power/powerapplet.cpp @@ -240,16 +240,7 @@ void PowerApplet::refreshBatteryIcon(const QString &icon) fallbackPath = ":/batteryicons/batteryicons/" + icon + "-dark.svg"; } - // 首先尝试从主题加载图标 - QIcon themeIcon = QIcon::fromTheme(iconName); - if (!themeIcon.isNull()) { - // 如果主题图标存在,使用主题图标 - QPixmap pixmap = themeIcon.pixmap(m_batteryIcon->size()); - m_batteryIcon->setPixmap(pixmap); - return; - } - - // fallback使用资源文件 + // 由于插件目前不跟随主题变化, 默认使用内置svg图标 QSvgRenderer renderer(fallbackPath); if (!renderer.isValid()) { QString normalPath = ":/batteryicons/batteryicons/" + icon + ".svg";