Skip to content

Commit b73fa49

Browse files
committed
fix: disable theme icon loading for battery display
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
1 parent 8e50618 commit b73fa49

1 file changed

Lines changed: 1 addition & 10 deletions

File tree

plugins/dde-dock/power/powerapplet.cpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -240,16 +240,7 @@ void PowerApplet::refreshBatteryIcon(const QString &icon)
240240
fallbackPath = ":/batteryicons/batteryicons/" + icon + "-dark.svg";
241241
}
242242

243-
// 首先尝试从主题加载图标
244-
QIcon themeIcon = QIcon::fromTheme(iconName);
245-
if (!themeIcon.isNull()) {
246-
// 如果主题图标存在,使用主题图标
247-
QPixmap pixmap = themeIcon.pixmap(m_batteryIcon->size());
248-
m_batteryIcon->setPixmap(pixmap);
249-
return;
250-
}
251-
252-
// fallback使用资源文件
243+
// 由于插件目前不跟随主题变化, 默认使用内置svg图标
253244
QSvgRenderer renderer(fallbackPath);
254245
if (!renderer.isValid()) {
255246
QString normalPath = ":/batteryicons/batteryicons/" + icon + ".svg";

0 commit comments

Comments
 (0)