Skip to content

feat: dconfig2cpp always add bindableFoo functions on Qt6 #461

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

Merged
merged 1 commit into from
Mar 6, 2025

Conversation

zccrs
Copy link
Member

@zccrs zccrs commented Mar 6, 2025

Direct string literal for the property name, because the literal was use on the Q_PROPERTY macro, so use the hex encode for the property name strings can't avoid the Chinese text codec problems.

@zccrs zccrs requested a review from 18202781743 March 6, 2025 03:02
deepin-ci-robot added a commit to linuxdeepin/dtk6core that referenced this pull request Mar 6, 2025
Synchronize source files from linuxdeepin/dtkcore.

Source-pull-request: linuxdeepin/dtkcore#461
Direct string literal for the property name, because the literal was
use on the Q_PROPERTY macro, so use the hex encode for the property name
strings can't avoid the Chinese text codec problems.
deepin-ci-robot added a commit to linuxdeepin/dtk6core that referenced this pull request Mar 6, 2025
Synchronize source files from linuxdeepin/dtkcore.

Source-pull-request: linuxdeepin/dtkcore#461
@deepin-ci-robot
Copy link
Contributor

deepin pr auto review

代码审查意见:

  1. 代码可读性

    • dconfig_org_deepin_dtk_preference.hpp文件中,将Unicode转义序列替换为普通字符串可以提高代码的可读性。例如,QStringLiteral(u"\u0061\u0075\u0074\u006f\u0044\u0069\u0073\u0070\u006c\u0061\u0079\u0046\u0065\u0061\u0074\u0075\u0072\u0065")可以简化为QStringLiteral("autoDisplayFeature")
  2. 条件编译

    • dconfig_org_deepin_dtk_preference.hpptools/dconfig2cpp/main.cpp文件中,使用了#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)进行条件编译,这是正确的做法,可以确保代码在Qt 6及以上版本中正确编译。
  3. 代码重复

    • dconfig_org_deepin_dtk_preference.hpp文件中,多个方法中存在重复的代码,例如setValuereset方法的调用。可以考虑将这些重复的代码提取到一个单独的函数中,以减少代码重复和提高代码的可维护性。
  4. 注释

    • tools/dconfig2cpp/main.cpp文件中,cppPropertyOption选项的注释应该更详细地说明该选项的作用,以便其他开发者理解。
  5. 性能

    • dconfig_org_deepin_dtk_preference.hpp文件中,keyList方法返回一个QStringList,如果这个列表很大,可能会导致性能问题。可以考虑使用QHashQMap来存储键值对,以提高查找效率。
  6. 安全性

    • 代码中没有明显的安全漏洞,但是应该确保所有用户输入都经过适当的验证和清理,以防止注入攻击。

总体来说,代码的修改提高了可读性和可维护性,同时通过条件编译确保了代码的兼容性。建议进一步优化重复代码,并确保所有用户输入都得到适当的处理。

@deepin-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 18202781743, zccrs

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

@zccrs zccrs merged commit e6985b9 into linuxdeepin:master Mar 6, 2025
19 of 21 checks passed
18202781743 pushed a commit to linuxdeepin/dtk6core that referenced this pull request Mar 6, 2025
Synchronize source files from linuxdeepin/dtkcore.

Source-pull-request: linuxdeepin/dtkcore#461
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.

3 participants