-
Notifications
You must be signed in to change notification settings - Fork 59
fix: Display name truncation #395
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
Center text horizontally in RecognizeDialog paint event Adjust the x-coordinate calculation in `RecognizeDialog::paintEvent` to properly center the text within the dialog. The previous calculation did not account for the full width of the text, resulting in misalignment. This change ensures the text is centered correctly. pms: BUG-307573
deepin pr auto review关键摘要:
是否建议立即修改:
|
Reviewer's GuideThis PR fixes the horizontal centering logic in RecognizeDialog by updating the x‐coordinate calculation in the paintEvent, ensuring text is centered based on its full width rather than misaligned by half its width. Sequence Diagram: Text Centering Logic in RecognizeDialog::paintEventsequenceDiagram
participant PE as "RecognizeDialog::paintEvent"
participant FM as "QFontMetrics"
participant PP as "QPainterPath"
PE->>FM: horizontalAdvance(m_text)
activate FM
FM-->>PE: textWidth
deactivate FM
alt Old X-Coordinate Calculation
PE->>PP: addText( (m_rect.width() - textWidth / 2.0), y_coord, font, m_text )
activate PP
PP-->>PE:
deactivate PP
else New X-Coordinate Calculation (Centered)
PE->>PP: addText( (m_rect.width() - textWidth) / 2.0, y_coord, font, m_text )
activate PP
PP-->>PE:
deactivate PP
end
Class Diagram: Update to RecognizeDialogclassDiagram
class RecognizeDialog {
+paintEvent(QPaintEvent *event) void
}
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.
Hey @robertkill - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: robertkill, xionglinlin 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 |
Center text horizontally in RecognizeDialog paint event
Adjust the x-coordinate calculation in
RecognizeDialog::paintEventto properly center the text within the dialog. The previous calculation did not account for the full width of the text, resulting in misalignment. This change ensures the text is centered correctly.pms: BUG-307573
Summary by Sourcery
Bug Fixes: