Skip to content

Conversation

@felixonmars
Copy link
Member

Credits to Antonio Rojas from Arch Linux.

Credits to Antonio Rojas from Arch Linux.
deepin-ci-robot added a commit to linuxdeepin/qt6integration that referenced this pull request Oct 14, 2025
Synchronize source files from linuxdeepin/qt5integration.

Source-pull-request: linuxdeepin/qt5integration#284
@github-actions
Copy link
Contributor

  • 敏感词检查失败, 检测到1个文件存在敏感词
详情
{
    "CMakeLists.txt": [
        {
            "line": "  HOMEPAGE_URL \"https://github.com/linuxdeepin/qt5integration\"",
            "line_number": 15,
            "rule": "S35",
            "reason": "Url link | cc21178aa0"
        }
    ]
}

CMakeLists.txt Outdated
if(PROJECT_VERSION_MAJOR EQUAL 6)
set(VERSION_SUFFIX 6)
find_package(QT NAMES Qt6 REQUIRED COMPONENTS Core)
find_package(Qt6 COMPONENTS CorePrivate GuiPrivate WidgetsPrivate REQUIRED)
Copy link
Contributor

Choose a reason for hiding this comment

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

CorePrivate在qt6.10才分的包吧, linuxdeepin/qt6integration#97 在qt6.8上编译错误了,

Copy link
Member Author

Choose a reason for hiding this comment

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

应该改好了~

deepin-ci-robot added a commit to linuxdeepin/qt6integration that referenced this pull request Oct 15, 2025
Synchronize source files from linuxdeepin/qt5integration.

Source-pull-request: linuxdeepin/qt5integration#284
@deepin-ci-robot
Copy link
Contributor

deepin pr auto review

我来审查这段代码,主要关注语法逻辑、代码质量、性能和安全性。

语法逻辑

  1. CMakeLists.txt 中的条件判断逻辑正确,根据 Qt 版本不同选择不同的模块。
  2. qdeepintheme.h 中的条件编译宏使用正确,根据 Qt 版本包含不同的头文件。

代码质量

  1. 在 CMakeLists.txt 中,建议为 Qt6 的私有模块添加更详细的注释,说明为什么需要这些私有模块。
  2. 条件编译宏 QT_VERSION >= QT_VERSION_CHECK(6, 10, 0) 的使用是正确的,但可以考虑将其定义为宏,以提高代码可读性和可维护性。

性能

  1. 代码中没有明显的性能问题。条件编译和模块查找只在构建时执行,不会影响运行时性能。

安全性

  1. 代码中使用了 REQUIRED 关键字查找 Qt 模块,如果模块不存在,构建过程会报错,这是好的实践。
  2. 建议在查找 Qt6 私有模块时添加错误处理,因为这些模块可能在某些 Qt6 版本中不可用。

改进建议

  1. 在 CMakeLists.txt 中,建议添加注释说明为什么需要 Qt6 的私有模块:
if(Qt6_VERSION VERSION_GREATER_EQUAL 6.10)
  # 需要Qt6的私有模块来实现某些高级功能
  find_package(Qt6 COMPONENTS CorePrivate GuiPrivate WidgetsPrivate REQUIRED)
endif()
  1. 考虑将版本检查定义为宏,以提高可维护性:
# 在 CMakeLists.txt 顶部定义
set(MIN_QT6_PRIVATE_VERSION "6.10.0")

# 在使用的地方
if(Qt6_VERSION VERSION_GREATER_EQUAL ${MIN_QT6_PRIVATE_VERSION})
  find_package(Qt6 COMPONENTS CorePrivate GuiPrivate WidgetsPrivate REQUIRED)
endif()
  1. 在 qdeepintheme.h 中,可以考虑添加注释说明为什么需要根据 Qt 版本包含不同的头文件:
#if QT_VERSION >= QT_VERSION_CHECK(6, 10, 0)
// Qt6.10及以上版本使用新的头文件路径
#include <private/qgenericunixtheme_p.h>
#else
// 旧版本Qt使用不同的头文件路径
#include <private/qgenericunixthemes_p.h>
#endif
  1. 考虑在查找 Qt6 私有模块时添加错误处理:
if(Qt6_VERSION VERSION_GREATER_EQUAL 6.10)
  if(NOT Qt6_FOUND)
    message(FATAL_ERROR "Qt6 is required but not found")
  endif()
  find_package(Qt6 COMPONENTS CorePrivate GuiPrivate WidgetsPrivate)
  if(NOT Qt6_CorePrivate_FOUND OR NOT Qt6_GuiPrivate_FOUND OR NOT Qt6_WidgetsPrivate_FOUND)
    message(WARNING "Some Qt6 private modules are not available. Some features may not work correctly.")
  endif()
endif()

这些建议可以提高代码的可读性、可维护性和健壮性,同时保持原有功能不变。

@github-actions
Copy link
Contributor

  • 敏感词检查失败, 检测到1个文件存在敏感词
详情
{
    "CMakeLists.txt": [
        {
            "line": "  HOMEPAGE_URL \"https://github.com/linuxdeepin/qt5integration\"",
            "line_number": 15,
            "rule": "S35",
            "reason": "Url link | cc21178aa0"
        }
    ]
}

@deepin-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

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

@18202781743 18202781743 merged commit 1b202c7 into linuxdeepin:master Oct 15, 2025
20 of 22 checks passed
18202781743 pushed a commit to linuxdeepin/qt6integration that referenced this pull request Oct 15, 2025
Synchronize source files from linuxdeepin/qt5integration.

Source-pull-request: linuxdeepin/qt5integration#284
@felixonmars felixonmars deleted the qt-6.10 branch October 15, 2025 02:59
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