Skip to content

fix: resolve various compilation warnings#679

Merged
deepin-bot[bot] merged 1 commit intolinuxdeepin:masterfrom
18202781743:master
Aug 14, 2025
Merged

fix: resolve various compilation warnings#679
deepin-bot[bot] merged 1 commit intolinuxdeepin:masterfrom
18202781743:master

Conversation

@18202781743
Copy link
Contributor

  1. Fixed unused parameter warnings by removing parameter names in lambda
    captures
  2. Added Qt version check for deprecated AA_UseHighDpiPixmaps attribute
  3. Fixed documentation comment syntax in DFontComboBox
  4. Added nullptr check for QGuiApplication::inputMethod()
  5. Added parent parameter in DPrintPreviewWidget constructor
  6. Fixed pixel metric switch case with static cast
  7. Updated meta type registration for Qt6 compatibility
  8. Removed unused variable casts in test cases
  9. Added Qt version check for QContextMenuEvent constructor

Influence:

  1. Verify UI elements still render correctly after DPI attribute changes
  2. Test input method behavior on tablet devices
  3. Check print preview functionality
  4. Validate combo box and text edit test cases still pass
  5. Confirm no new warnings appear during compilation

fix: 修复各种编译警告

  1. 在lambda捕获中移除未使用的参数名以消除警告
  2. 添加Qt版本检查处理废弃的AA_UseHighDpiPixmaps属性
  3. 修复DFontComboBox中的文档注释语法
  4. 为QGuiApplication::inputMethod()添加nullptr检查
  5. 在DPrintPreviewWidget构造函数中添加父控件参数
  6. 使用静态转换修复像素度量switch case
  7. 更新元类型注册以兼容Qt6
  8. 移除测试用例中未使用的变量转换
  9. 为QContextMenuEvent构造函数添加Qt版本检查

Influence:

  1. 验证DPI属性变更后UI元素仍能正确渲染
  2. 测试平板设备上的输入法行为
  3. 检查打印预览功能
  4. 确保组合框和文本编辑测试用例仍能通过
  5. 确认编译时不再出现新的警告

@18202781743 18202781743 requested review from BLumia and mhduiy August 14, 2025 02:24
deepin-ci-robot added a commit to linuxdeepin/dtk6widget that referenced this pull request Aug 14, 2025
Synchronize source files from linuxdeepin/dtkwidget.

Source-pull-request: linuxdeepin/dtkwidget#679
@github-actions
Copy link
Contributor

  • 敏感词检查失败, 检测到1个文件存在敏感词
详情
{
    "src/widgets/dstyleditemdelegate.cpp": [
        {
            "line": "  \brief 设置项 item 的集合列表 \a list, 只显示有 text 的 DViewItemActionList 集合",
            "line_number": 1538,
            "rule": "C128",
            "reason": "政治敏感词 | b231f13999"
        }
    ]
}

mhduiy
mhduiy previously approved these changes Aug 14, 2025
1. Fixed unused parameter warnings by removing parameter names in lambda
captures
2. Added Qt version check for deprecated AA_UseHighDpiPixmaps attribute
3. Fixed documentation comment syntax in DFontComboBox
4. Added nullptr check for QGuiApplication::inputMethod()
5. Added parent parameter in DPrintPreviewWidget constructor
6. Fixed pixel metric switch case with static cast
7. Updated meta type registration for Qt6 compatibility
8. Removed unused variable casts in test cases
9. Added Qt version check for QContextMenuEvent constructor

Influence:
1. Verify UI elements still render correctly after DPI attribute changes
2. Test input method behavior on tablet devices
3. Check print preview functionality
4. Validate combo box and text edit test cases still pass
5. Confirm no new warnings appear during compilation

fix: 修复各种编译警告

1. 在lambda捕获中移除未使用的参数名以消除警告
2. 添加Qt版本检查处理废弃的AA_UseHighDpiPixmaps属性
3. 修复DFontComboBox中的文档注释语法
4. 为QGuiApplication::inputMethod()添加nullptr检查
5. 在DPrintPreviewWidget构造函数中添加父控件参数
6. 使用静态转换修复像素度量switch case
7. 更新元类型注册以兼容Qt6
8. 移除测试用例中未使用的变量转换
9. 为QContextMenuEvent构造函数添加Qt版本检查

Influence:
1. 验证DPI属性变更后UI元素仍能正确渲染
2. 测试平板设备上的输入法行为
3. 检查打印预览功能
4. 确保组合框和文本编辑测试用例仍能通过
5. 确认编译时不再出现新的警告
deepin-ci-robot added a commit to linuxdeepin/dtk6widget that referenced this pull request Aug 14, 2025
Synchronize source files from linuxdeepin/dtkwidget.

Source-pull-request: linuxdeepin/dtkwidget#679
@18202781743 18202781743 requested a review from mhduiy August 14, 2025 10:56
@deepin-ci-robot
Copy link
Contributor

deepin pr auto review

代码审查意见:

  1. buttonexample.cpp文件中,connect函数的lambda表达式参数列表中移除了DGuiApplicationHelper::SizeMode类型,这可能会影响信号与槽的连接,需要确认是否所有情况下都适用。

  2. main.cpp文件中,DApplication::setAttribute(Qt::AA_UseHighDpiPixmaps, true);这行代码被包裹在#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))条件编译指令中,这意味着在Qt 6.0.0及以上版本中,这行代码不会被执行。如果这是有意为之,请确保这一改动不会影响其他依赖于这一设置的功能。

  3. widgetexample.cpp文件中,CalendarModel::data函数中使用了条件编译指令#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)来处理不同版本的Qt。建议使用#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0),因为Qt 6.0.0的版本号是6.0.0,而不是6.0.0.0。

  4. dapplicationsettings.h文件中,DApplicationSettings类的构造函数被标记为Q_DECL_DEPRECATED,但是没有提供替代方案。建议提供替代方案或者移除Q_DECL_DEPRECATED标记。

  5. dhidpihelper.h文件中,DHiDPIHelper类的loadNxPixmap函数被标记为D_DECL_DEPRECATED,但是没有提供替代方案。建议提供替代方案或者移除D_DECL_DEPRECATED标记。

  6. dcustomermacrowidget.h文件中,DSegmentedHighlightDSegmentedControl头文件被注释掉了,如果这些类不再使用,建议移除这些注释。

  7. CMakeLists.txt文件中,添加了D_IGNORE_DEPRECATIONS编译定义,这可能会忽略所有Qt的弃用警告。建议在添加这个定义之前,确保所有弃用的功能都有替代方案。

  8. dwidgetutil.cpp文件中,moveToCenter函数中使用了条件编译指令#if QT_VERSION < QT_VERSION_CHECK(5, 11, 0),建议使用#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0),因为Qt 6.0.0的版本号是6.0.0,而不是6.0.0.0。

  9. daboutdialog.cpp文件中,companyLogo函数中使用了const_cast来修改私有成员变量companyLogoPixmap,这可能会导致未定义行为。建议避免使用const_cast

  10. dbaseexpand.cpp文件中,DBaseExpand::expandChange函数的文档注释中使用了@fn标签,但是没有提供函数的名称。建议提供函数的名称。

  11. dfontcombobox.cpp文件中,DFontComboBox::DFontComboBox构造函数的文档注释中使用了@endcode标签,但是没有提供对应的@code标签。建议添加@code标签。

  12. dlineedit.cpp文件中,DLineEdit::eventFilter函数中使用了DGuiApplicationHelper::IsTableEnvironment,但是没有提供DGuiApplicationHelper::IsTableEnvironment的定义。建议提供DGuiApplicationHelper::IsTableEnvironment的定义。

  13. dprintpreviewwidget.cpp文件中,DPrintPreviewWidget::DPrintPreviewWidget构造函数中使用了parent参数,但是没有提供parent参数的文档注释。建议添加parent参数的文档注释。

  14. dstyle.cpp文件中,DStyle::pixelMetric函数中使用了switch语句,但是没有使用break语句。建议在每个case语句的末尾添加break语句。

  15. dstyleditemdelegate.cpp文件中,registerMetaType函数被标记为__attribute__((constructor)),但是没有提供替代方案。建议提供替代方案或者移除__attribute__((constructor))标记。

  16. dtitlebareditpanel.cpp文件中,DCollapseWidget::collapse函数中使用了qobject_cast,但是没有提供DragDropWidget类的定义。建议提供DragDropWidget类的定义。

  17. ut_dcombobox.cpp文件中,ut_DComboBox::maxVisibleItems测试函数中使用了QTest::qWaitForWindowExposed,但是没有提供target->windowHandle()的文档注释。建议添加target->windowHandle()的文档注释。

  18. ut_dtextedit.cpp文件中,ut_DTextEdit::testDTextEditContextMenuEvent测试函数中使用了QContextMenuEvent,但是没有提供QContextMenuEvent的文档注释。建议添加QContextMenuEvent的文档注释。

@github-actions
Copy link
Contributor

  • 敏感词检查失败, 检测到1个文件存在敏感词
详情
{
    "src/widgets/dstyleditemdelegate.cpp": [
        {
            "line": "  \brief 设置项 item 的集合列表 \a list, 只显示有 text 的 DViewItemActionList 集合",
            "line_number": 1538,
            "rule": "C128",
            "reason": "政治敏感词 | b231f13999"
        }
    ]
}

@18202781743 18202781743 requested a review from zccrs August 14, 2025 11:14
@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
Copy link
Contributor Author

/forcemerge

@deepin-bot
Copy link
Contributor

deepin-bot bot commented Aug 14, 2025

This pr force merged! (status: blocked)

@deepin-bot deepin-bot bot merged commit bd6a9cd into linuxdeepin:master Aug 14, 2025
21 of 23 checks passed
18202781743 pushed a commit to linuxdeepin/dtk6widget that referenced this pull request Aug 14, 2025
Synchronize source files from linuxdeepin/dtkwidget.

Source-pull-request: linuxdeepin/dtkwidget#679
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

Comments