-
Notifications
You must be signed in to change notification settings - Fork 31
Fix power and bluetooth cut in russian #371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Hi @hardWorker254. Thanks for your PR. 😃 |
|
Hi @hardWorker254. Thanks for your PR. I'm waiting for a linuxdeepin member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
CLA Assistant Lite bot: You can retrigger this bot by commenting recheck in this Pull Request |
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThis PR ensures that power and Bluetooth tip labels fully display localized text by using QFontMetrics to calculate the rendered text width and setting the label’s minimum width accordingly, alongside minor formatting tweaks in the loadPlugin function. Sequence diagram for BluetoothItem tips label width adjustmentsequenceDiagram
participant BluetoothItem
participant QLabel as "m_tipsLabel"
participant QFontMetrics
BluetoothItem->>QLabel: setText(tipsText)
BluetoothItem->>QFontMetrics: QFontMetrics(m_tipsLabel.font())
BluetoothItem->>QFontMetrics: boundingRect(m_tipsLabel.text())
QFontMetrics-->>BluetoothItem: QRect (width)
BluetoothItem->>QLabel: setMinimumWidth(textWidth)
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743, hardWorker254 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Fixes text truncation issues in Russian language UI for power and bluetooth dock plugins by dynamically calculating and setting minimum label widths based on rendered text dimensions.
- Adds dynamic width calculation for tip labels in both power and bluetooth plugins
- Prevents UI text truncation by ensuring labels are sized to accommodate their content
- Addresses localization issues where longer translated text was being cut off
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| plugins/dde-dock/power/powerplugin.cpp | Adds font metrics calculation and minimum width setting for power plugin tip labels |
| plugins/dde-dock/bluetooth/bluetoothitem.cpp | Adds font metrics calculation and minimum width setting for bluetooth plugin tip labels |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| m_tipsLabel->setText(tips); | ||
| QFontMetrics metrics(m_tipsLabel->font()); | ||
| int textWidth = metrics.boundingRect(m_tipsLabel->text()).width(); | ||
| m_tipsLabel->setMinimumWidth(textWidth); |
Copilot
AI
Sep 25, 2025
There was a problem hiding this comment.
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.
| m_tipsLabel->setMinimumWidth(textWidth); | |
| const int horizontalPadding = 8; // pixels | |
| m_tipsLabel->setMinimumWidth(textWidth + horizontalPadding); |
| m_tipsLabel->setText(tipsText); | ||
| QFontMetrics metrics(m_tipsLabel->font()); | ||
| int textWidth = metrics.boundingRect(m_tipsLabel->text()).width(); | ||
| m_tipsLabel->setMinimumWidth(textWidth); |
Copilot
AI
Sep 25, 2025
There was a problem hiding this comment.
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.
| m_tipsLabel->setMinimumWidth(textWidth); | |
| const int horizontalPadding = 12; // Add 12px padding for better visual spacing | |
| m_tipsLabel->setMinimumWidth(textWidth + horizontalPadding); |
|
TAG Bot New tag: 2.0.12 |
|
Thanks for your contribution! ❤️ |
linuxdeepin/developer-center#12262
Summary by Sourcery
Prevent UI text truncation in power and bluetooth plugins by dynamically sizing tip labels to fit rendered text
Bug Fixes: