Skip to content

fix: link Qt CorePrivate for Qt 6.10+ QtXlsx builds - #740

Merged
lzwind merged 1 commit into
linuxdeepin:masterfrom
felixonmars:fix-qtxlsx-coreprivate
Aug 31, 2026
Merged

fix: link Qt CorePrivate for Qt 6.10+ QtXlsx builds#740
lzwind merged 1 commit into
linuxdeepin:masterfrom
felixonmars:fix-qtxlsx-coreprivate

Conversation

@felixonmars

@felixonmars felixonmars commented Aug 30, 2026

Copy link
Copy Markdown
Member

The bundled QtXlsx sources include QtCore private zip headers, such as private/qzipreader_p.h and private/qzipwriter_p.h. Qt 6.10+ no longer exposes the CorePrivate target through the Core component, so request CorePrivate for those builds and link it to supply the versioned QtCore private include directory.

Summary by Sourcery

Link Qt CorePrivate for Qt 6.10+ so bundled QtXlsx sources can access versioned private Core headers.

Bug Fixes:

  • Enable bundled QtXlsx builds with Qt 6.10 and newer by linking the Qt Core private target needed for private ZIP headers.

Build:

  • Add Qt 6 CorePrivate to the configured components for Qt 6.10+ and link it to the application.

@sourcery-ai

sourcery-ai Bot commented Aug 30, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Qt 6 builds now discover and link the CorePrivate component, enabling the bundled QtXlsx sources to include versioned QtCore private zip headers.

File-Level Changes

Change Details Files
Expose Qt CorePrivate headers and link the corresponding target for Qt 6 builds.
  • Add CorePrivate to the Qt component discovery list when using Qt 6.
  • Link the versioned Qt CorePrivate target alongside the existing Qt dependencies so CMake supplies QtCore’s private include directory.
deepin-devicemanager/CMakeLists.txt

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot 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.

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="deepin-devicemanager/CMakeLists.txt" line_range="123" />
<code_context>
 # Add components only available in Qt6, remove SvgWidgets from Qt5
 if(${QT_VERSION_MAJOR} EQUAL 6)
-    list(APPEND QT_COMPONENTS OpenGL OpenGLWidgets)
+    list(APPEND QT_COMPONENTS OpenGL OpenGLWidgets CorePrivate)
 else()
     # Remove SvgWidgets for Qt5 (not available)
</code_context>
<issue_to_address>
**issue (bug_risk):** CMake treats `CorePrivate` as a standalone Qt component and attempts to resolve a `Qt6CorePrivate` package, but Qt 6 exposes `Qt6::CorePrivate` through the Core package rather than providing a separate component package. Configuration therefore fails before the target can be generated on standard Qt 6 installations.

**Triggers:** When configuring any Qt 6 build with the standard Qt CMake package files.

**Suggested fix:** Keep `CorePrivate` out of `QT_COMPONENTS` and link `Qt6::CorePrivate` after finding the regular `Core` component.

```suggestion
    list(APPEND QT_COMPONENTS OpenGL OpenGLWidgets)
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread deepin-devicemanager/CMakeLists.txt Outdated
# Add components only available in Qt6, remove SvgWidgets from Qt5
if(${QT_VERSION_MAJOR} EQUAL 6)
list(APPEND QT_COMPONENTS OpenGL OpenGLWidgets)
list(APPEND QT_COMPONENTS OpenGL OpenGLWidgets CorePrivate)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

issue (bug_risk): CMake treats CorePrivate as a standalone Qt component and attempts to resolve a Qt6CorePrivate package, but Qt 6 exposes Qt6::CorePrivate through the Core package rather than providing a separate component package. Configuration therefore fails before the target can be generated on standard Qt 6 installations.

Triggers: When configuring any Qt 6 build with the standard Qt CMake package files.

Suggested fix: Keep CorePrivate out of QT_COMPONENTS and link Qt6::CorePrivate after finding the regular Core component.

Suggested change
list(APPEND QT_COMPONENTS OpenGL OpenGLWidgets CorePrivate)
list(APPEND QT_COMPONENTS OpenGL OpenGLWidgets)

The bundled QtXlsx sources include QtCore private zip headers, such as private/qzipreader_p.h and private/qzipwriter_p.h. Qt 6.10+ no longer exposes the CorePrivate target through the Core component, so request CorePrivate for those builds and link it to supply the versioned QtCore private include directory.
@felixonmars
felixonmars force-pushed the fix-qtxlsx-coreprivate branch from 088fd7f to 81cc02f Compare August 30, 2026 10:06
@felixonmars felixonmars changed the title fix: link Qt CorePrivate for bundled QtXlsx fix: link Qt CorePrivate for Qt 6.10+ QtXlsx builds Aug 30, 2026
@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

🤖 AI 代码审查报告

总体评分: 98 分 (通过阈值: 70分)

Pass


📊 总体评价

项目 结果
审查结论 代码审查通过
评分详情 总体评分 98 分,大于 70 分通过阈值。本次变更为 CMake 构建配置修复,为 bundled QtXlsx 链接 Qt CorePrivate 组件,语法正确、逻辑清晰,未发现安全漏洞。

🔍 详细分析

1. 语法逻辑 ✅

评价: 优秀 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: CMake 语法正确,版本守卫逻辑合理。if(Qt6_VERSION VERSION_GREATER_EQUAL 6.10.0) 使用了正确的版本比较运算符,list(APPEND QT_COMPONENTS CorePrivate) 语法正确,target_link_libraries 中 Qt${QT_VERSION_MAJOR}::CorePrivate 命名规范。条件嵌套结构清晰,Qt5 不受影响,Qt6 < 6.10.0 不受 find_package 变化影响。


2. 代码质量 ✅

评价: 优秀 ✅ 通过

潜在问题:

  1. deepin-devicemanager/CMakeLists.txt:124 - 新增的 CorePrivate 版本守卫缺少注释说明为何 6.10.0 是分界版本

建议: 建议在 if(Qt6_VERSION VERSION_GREATER_EQUAL 6.10.0) 上方添加简要注释,说明 CorePrivate 组件在 Qt 6.10.0+ 需要显式声明,例如:# CorePrivate required for bundled QtXlsx, explicit component needed since Qt 6.10.0


3. 代码性能 ✅

评价: 优秀 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: CMake 构建配置变更,不影响运行时性能。版本检查为构建时操作,添加 CorePrivate 链接对构建时间影响可忽略。


4. 代码安全 🔒

评价: 优秀 ✅ 通过

🔐 发现 0 个安全漏洞

安全漏洞详情:
✅ 未发现安全漏洞

建议: CMake 构建配置中无命令注入风险,无硬编码密钥或敏感信息,无用户输入处理。安全合规。


💡 改进建议代码示例

# Add components only available in Qt6, remove SvgWidgets from Qt5
if(${QT_VERSION_MAJOR} EQUAL 6)
    list(APPEND QT_COMPONENTS OpenGL OpenGLWidgets)
    # CorePrivate required for bundled QtXlsx, explicit component needed since Qt 6.10.0
    if(Qt6_VERSION VERSION_GREATER_EQUAL 6.10.0)
        list(APPEND QT_COMPONENTS CorePrivate)
    endif()
else()
    # Remove SvgWidgets for Qt5 (not available)
    list(REMOVE_ITEM QT_COMPONENTS SvgWidgets)
endif()

本报告由 AI 代码审查工具自动生成

@lzwind
lzwind merged commit d1c9e76 into linuxdeepin:master Aug 31, 2026
17 checks passed
@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

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

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