Skip to content

fix: resolve compilation warnings and Qt6 compatibility issues#495

Merged
18202781743 merged 1 commit intolinuxdeepin:masterfrom
18202781743:master
Jul 28, 2025
Merged

fix: resolve compilation warnings and Qt6 compatibility issues#495
18202781743 merged 1 commit intolinuxdeepin:masterfrom
18202781743:master

Conversation

@18202781743
Copy link
Contributor

  1. Replaced QScopedPointer with std::unique_ptr for better memory
    management and consistency
  2. Added Qt6-specific includes (type_traits) for compatibility
  3. Updated qAsConst to std::as_const for Qt6 compatibility
  4. Fixed time handling in DRecentManager for Qt6 by using QTimeZone
  5. Added missing memory header for smart pointers

These changes address compiler warnings and ensure proper functionality
across both Qt5 and Qt6 versions, while modernizing the codebase with
standard C++ features.

fix: 修复编译警告和Qt6兼容性问题

  1. 使用std::unique_ptr替代QScopedPointer以获得更好的内存管理和一致性
  2. 添加Qt6特定的头文件(type_traits)以保证兼容性
  3. 将qAsConst更新为std::as_const以兼容Qt6
  4. 在DRecentManager中修复Qt6的时间处理问题,使用QTimeZone
  5. 添加缺失的memory头文件以支持智能指针

这些修改解决了编译器警告问题,并确保代码在Qt5和Qt6版本中都能正常工作,同
时使用标准C++特性使代码更现代化。

@18202781743 18202781743 requested review from BLumia and mhduiy July 24, 2025 12:31
deepin-ci-robot added a commit to linuxdeepin/dtk6core that referenced this pull request Jul 24, 2025
Synchronize source files from linuxdeepin/dtkcore.

Source-pull-request: linuxdeepin/dtkcore#495
deepin-ci-robot added a commit to linuxdeepin/dtk6core that referenced this pull request Jul 25, 2025
Synchronize source files from linuxdeepin/dtkcore.

Source-pull-request: linuxdeepin/dtkcore#495
1. Replaced QScopedPointer with std::unique_ptr for better memory
management and consistency
2. Fixed time handling in DRecentManager for Qt6 by using QTimeZone
3. Added missing memory header for smart pointers

These changes address compiler warnings and ensure proper functionality
across both Qt5 and Qt6 versions, while modernizing the codebase with
standard C++ features.

fix: 修复编译警告和Qt6兼容性问题

1. 使用std::unique_ptr替代QScopedPointer以获得更好的内存管理和一致性
2. 在DRecentManager中修复Qt6的时间处理问题,使用QTimeZone
3. 添加缺失的memory头文件以支持智能指针

这些修改解决了编译器警告问题,并确保代码在Qt5和Qt6版本中都能正常工作,同
时使用标准C++特性使代码更现代化。
deepin-ci-robot added a commit to linuxdeepin/dtk6core that referenced this pull request Jul 25, 2025
Synchronize source files from linuxdeepin/dtkcore.

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

deepin pr auto review

关键摘要:

  • dconfig.cpp中,QScopedPointer被替换为std::unique_ptr,这是一个好的做法,因为它提供了更好的资源管理。
  • dconfig.cpp中,file.take()被替换为file.release(),这可能会导致资源泄露,因为std::unique_ptrrelease方法会返回裸指针,并且不再拥有该资源。
  • drecentmanager.cpp中,添加了对QTimeZone的包含,这是一个好的做法,因为它确保了代码的兼容性。

是否建议立即修改:

  • 是,需要立即修改dconfig.cppfile.release()的使用,因为它可能会导致资源泄露。应该使用std::unique_ptrstd::move来转移所有权,而不是release

@deepin-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

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 e900940 into linuxdeepin:master Jul 28, 2025
19 of 20 checks passed
18202781743 pushed a commit to linuxdeepin/dtk6core that referenced this pull request Jul 28, 2025
Synchronize source files from linuxdeepin/dtkcore.

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