Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions plugins/dde-dock/bluetooth/bluetoothitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ void BluetoothItem::refreshTips()
}

m_tipsLabel->setText(tipsText);
QFontMetrics metrics(m_tipsLabel->font());
int textWidth = metrics.boundingRect(m_tipsLabel->text()).width();
m_tipsLabel->setMinimumWidth(textWidth);
Copy link

Copilot AI Sep 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider adding padding to the calculated width to ensure proper visual spacing. The current implementation sets the minimum width exactly to the text width, which may result in text appearing cramped against the label edges.

Suggested change
m_tipsLabel->setMinimumWidth(textWidth);
const int horizontalPadding = 12; // Add 12px padding for better visual spacing
m_tipsLabel->setMinimumWidth(textWidth + horizontalPadding);

Copilot uses AI. Check for mistakes.
m_quickPanel->setDescription(description);
}

Expand Down
7 changes: 6 additions & 1 deletion plugins/dde-dock/power/powerplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ void PowerPlugin::loadPlugin()
}
refreshTipsData();
});

connect(m_systemPowerInter, &SystemPowerInter::BatteryTimeToEmptyChanged, this, &PowerPlugin::refreshTipsData);
connect(m_systemPowerInter, &SystemPowerInter::BatteryTimeToFullChanged, this, &PowerPlugin::refreshTipsData);
connect(m_systemPowerInter, &SystemPowerInter::BatteryPercentageChanged, this, &PowerPlugin::refreshTipsData);
Expand All @@ -226,6 +227,7 @@ void PowerPlugin::loadPlugin()

onDConfigValueChanged("showTimeToFull");
m_powerStatusWidget->refreshIcon();

}

void PowerPlugin::refreshPluginItemsVisible()
Expand Down Expand Up @@ -347,7 +349,10 @@ void PowerPlugin::refreshTipsData()
}
}

m_tipsLabel->setText(tips);
m_tipsLabel->setText(tips);
QFontMetrics metrics(m_tipsLabel->font());
int textWidth = metrics.boundingRect(m_tipsLabel->text()).width();
m_tipsLabel->setMinimumWidth(textWidth);
Copy link

Copilot AI Sep 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider adding padding to the calculated width to ensure proper visual spacing. The current implementation sets the minimum width exactly to the text width, which may result in text appearing cramped against the label edges.

Suggested change
m_tipsLabel->setMinimumWidth(textWidth);
const int horizontalPadding = 8; // pixels
m_tipsLabel->setMinimumWidth(textWidth + horizontalPadding);

Copilot uses AI. Check for mistakes.
m_powerStatusWidget->refreshBatteryPercentage(value, appletTips);
}

Expand Down
Loading