Skip to content

fix: DLineEdit增加Alert文本对齐接口#654

Closed
shao-jun wants to merge 1 commit into
linuxdeepin:masterfrom
shao-jun:master
Closed

fix: DLineEdit增加Alert文本对齐接口#654
shao-jun wants to merge 1 commit into
linuxdeepin:masterfrom
shao-jun:master

Conversation

@shao-jun

@shao-jun shao-jun commented Apr 16, 2025

Copy link
Copy Markdown
Contributor

DLineEdit的Alert文本默认是居中对齐,针对多行文本的情况需要控制其对齐方向;
原接口setMessageAlignment是修改Alert弹框的对齐方式,接口名称容易误解成修改文本,将其实现修改成文本对齐方式;
新接口setAlertAlignment,用于修改Alert弹框的对齐方式;

Log:
Influence: DLineEdit的Alert效果
Change-Id: I251400365fc6fdc29ee1cb1f11efdc81eaf2d939

@deepin-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: shao-jun

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

deepin-ci-robot added a commit to linuxdeepin/dtk6widget that referenced this pull request Apr 16, 2025
Synchronize source files from linuxdeepin/dtkwidget.

Source-pull-request: linuxdeepin/dtkwidget#654
 DLineEdit的Alert文本默认是居中对齐,针对多行文本的情况需要控制其对齐方向;
 原接口setMessageAlignment是修改Alert弹框的对齐方式,接口名称容易误解成修改文本,将其实现修改成文本对齐方式;
 新接口setAlertAlignment,用于修改Alert弹框的对齐方式;

Log:
Influence: DLineEdit的Alert效果
Change-Id: I251400365fc6fdc29ee1cb1f11efdc81eaf2d939
@deepin-ci-robot

Copy link
Copy Markdown
Contributor

deepin pr auto review

关键摘要:

  • DAlertControl 类中的 setMessageAlignmentmessageAlignment 方法被重命名为 setAlertAlignmentalertAlignment,但注释中仍然提到 setMessageAlignment,这可能会导致混淆。
  • DLineEdit 类中新增的 setAlertAlignmentalertAlignment 方法应该与 DAlertControl 类中的方法保持一致,以避免混淆。
  • DAlertControl 类中的 showAlertMessage 方法中新增了对 d->messageAlignment 的设置,但未在注释中说明这一变化。
  • DAlertControlPrivate 类中新增了 messageAlignment 成员变量,但未在注释中说明其用途。

是否建议立即修改:

  • 应该立即更新注释,确保它们与实际的方法名称和功能一致。
  • 应该检查 DLineEdit 类中的新增方法是否与 DAlertControl 类中的方法保持一致,并在必要时进行相应的调整。
  • 应该在 DAlertControlPrivate 类中添加适当的注释,说明 messageAlignment 成员变量的用途。

deepin-ci-robot added a commit to linuxdeepin/dtk6widget that referenced this pull request Apr 16, 2025
Synchronize source files from linuxdeepin/dtkwidget.

Source-pull-request: linuxdeepin/dtkwidget#654
@deepin-bot

deepin-bot Bot commented Apr 17, 2025

Copy link
Copy Markdown
Contributor

TAG Bot

New tag: 5.7.14
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #655

@zccrs
zccrs requested a review from Copilot April 21, 2025 02:23

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces separate APIs for controlling alert popup alignment and text alignment in DLineEdit to resolve ambiguity between the existing setMessageAlignment interface and actual alert alignment functionality.

  • Added new API setAlertAlignment and alertAlignment in DLineEdit and DAlertControl.
  • Introduced a new private member for text alignment with corresponding getters and setters.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/widgets/private/dalertcontrol_p.h Added a new messageAlignment property to control text alignment in alerts.
src/widgets/dlineedit.cpp Exposed new APIs for alert alignment and its getter.
src/widgets/dalertcontrol.cpp Renamed setMessageAlignment/getMessageAlignment to separate text alignment from alert alignment and introduced new alert alignment APIs.
include/widgets/dlineedit.h Updated header to declare new alert alignment interfaces.
include/widgets/dalertcontrol.h Updated header to declare new alert alignment interfaces.

Comment on lines +30 to 31
Qt::Alignment messageAlignment{Qt::AlignLeft};
QTimer timer;

Copilot AI Apr 21, 2025

Copy link

Choose a reason for hiding this comment

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

Default initialization of messageAlignment is set to Qt::AlignLeft, but documentation in dalertcontrol.cpp indicates a default of center alignment. Consider updating the default value to Qt::AlignCenter for consistency.

Suggested change
Qt::Alignment messageAlignment{Qt::AlignLeft};
QTimer timer;
Qt::Alignment messageAlignment{Qt::AlignCenter};

Copilot uses AI. Check for mistakes.
@deepin-bot

deepin-bot Bot commented May 8, 2025

Copy link
Copy Markdown
Contributor

TAG Bot

New tag: 5.7.15
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #661

@deepin-bot

deepin-bot Bot commented May 19, 2025

Copy link
Copy Markdown
Contributor

TAG Bot

New tag: 5.7.16
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #662

@deepin-bot

deepin-bot Bot commented Jun 19, 2025

Copy link
Copy Markdown
Contributor

TAG Bot

New tag: 5.7.17
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #666

@deepin-bot

deepin-bot Bot commented Jun 27, 2025

Copy link
Copy Markdown
Contributor

TAG Bot

New tag: 5.7.18
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #668

@deepin-bot

deepin-bot Bot commented Jul 3, 2025

Copy link
Copy Markdown
Contributor

TAG Bot

New tag: 5.7.19
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #670

@18202781743 18202781743 closed this Jul 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants