Skip to content
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

fix: optimize search edit widget signal connection #2429

Merged

Conversation

Johnson-zs
Copy link
Contributor

@Johnson-zs Johnson-zs commented Nov 24, 2024

fix: optimize search edit widget signal connection

  • Change textChanged signal to textEdited to avoid unnecessary signal emissions
  • Remove redundant DTK macro check for DSizeMode header
  • Fix signal-slot connection to prevent potential text processing issues

Log: This commit fixes the search widget's behavior by using textEdited instead of textChanged signal, which only triggers when user actually types or modifies the text, avoiding unnecessary signal emissions from programmatic text changes.

- Change textChanged signal to textEdited to avoid unnecessary signal emissions
- Remove redundant DTK macro check for DSizeMode header
- Fix signal-slot connection to prevent potential text processing issues

Log: This commit fixes the search widget's behavior by using textEdited instead
of textChanged signal, which only triggers when user actually types or
modifies the text, avoiding unnecessary signal emissions from programmatic
text changes.
@deepin-ci-robot
Copy link

deepin pr auto review

代码审查意见:

  1. 代码注释:在searcheditwidget.cpp文件中,移除了#ifdef DTKWIDGET_CLASS_DSizeMode#endif的注释,但没有添加相应的注释说明为什么移除这些代码。建议添加注释说明这些代码的用途以及为什么不再需要。

  2. 信号槽连接:在searcheditwidget.cpp文件中,将DSearchEdit::textChanged信号连接到onTextChanged槽函数更改为DSearchEdit::textEdited信号连接到onTextEdited槽函数。这是一个合理的改动,因为textEdited信号在文本编辑时立即触发,而textChanged信号在文本改变后触发。这可能是为了更及时地处理文本编辑事件。

  3. 槽函数命名:在searcheditwidget.h文件中,将onTextChanged槽函数的命名更改为onTextEdited。这是一个好的做法,因为槽函数的命名应该反映其功能。onTextEditedonTextChanged更准确地描述了槽函数的功能。

  4. 代码风格:在searcheditwidget.cpp文件中,移除了不必要的空行,这有助于提高代码的可读性。

  5. 未使用的代码:在searcheditwidget.cpp文件中,移除了#ifdef DTKWIDGET_CLASS_DSizeMode#endif的注释,但没有移除相应的代码。如果这些代码不再使用,建议完全移除它们以保持代码的整洁。

总体来说,这些改动是合理的,没有发现明显的语法或逻辑错误。但是,建议在移除代码时添加相应的注释,以便其他开发者理解为什么移除这些代码。

@Johnson-zs Johnson-zs changed the title fix: fix: optimize search edit widget signal connection Nov 24, 2024
@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Clauszy, Johnson-zs, Lighto-Ku

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

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

@Johnson-zs Johnson-zs merged commit 625fd16 into linuxdeepin:develop/snipe-25 Nov 25, 2024
17 checks passed
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