winforms-to-qt-mapper

提供完整的C# WinForms到Qt C++迁移指导,包括架构分析、控件映射、事件转换、布局迁移、性能优化和测试验证。适用于从单体WinForms应用重构为分层Qt架构的企业级项目。 使用时机: - 需要将WinForms应用迁移到Qt框架时 - 需要设计Qt分层架构和接口层时 - 需要分析WinForms项目并识别迁移策略时 - 需要转换C#事件处理到Qt信号槽时 - 需要优化Qt项目性能时 - 需要建立Qt测试体系时 基于企业级项目迁移实战经验: - 完整的MainControlWrapper接口设计 - 全面的测试用例覆盖 - 显著性能提升 - 零编译错误,零链接错误 - 完整的架构分析和优化策略 - UI 100%一致性验证方法

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "winforms-to-qt-mapper" with this command: npx skills add rsgt945/winforms-csharp-to-qt-mapper

WinForms到Qt迁移工具

快速开始

场景A: 全新项目迁移

# 1. 分析WinForms项目架构
node scripts/architecture_analyzer.js --project <路径> --output <文件>

# 2. 生成迁移计划
node scripts/migration_planner.js --analysis <分析结果> --output <计划文件>

# 3. 生成Qt代码
node scripts/code_generator.js --mapping <映射文件> --output <目录>

场景B: 架构重构

# 1. 设计分层架构
node scripts/layered_architect.js --project <路径> --output <设计文件>

# 2. 创建接口层
node scripts/interface_generator.js --analysis <分析结果> --output <目录>

# 3. 性能优化
node scripts/performance_optimizer.js --project <路径> --output <优化建议>

场景C: 现有项目优化

# 1. 性能分析
node scripts/performance_analyzer.js --project <路径> --output <分析报告>

# 2. 测试生成
node scripts/test_generator.js --project <路径> --output <测试目录>

核心功能

1. 架构分析

功能: 分析WinForms单体架构,识别依赖关系和复杂度

输出:

  • 依赖图和复杂度分析
  • 重构建议和优先级
  • 接口层设计方案

详细指南: architecture_analysis.md

2. 接口层生成

功能: 生成MainControlWrapper接口层代码

特性:

  • 标准接口分类(初始化/控制、数据获取、配置管理等)
  • 接口命名规范
  • 测试框架自动生成

详细指南: interface_layer.md

3. 代码转换

功能: WinForms代码到Qt代码的转换

包含:

4. 性能优化

功能: Qt项目性能分析和优化

优化策略:

  • 延迟加载策略
  • UI刷新优化
  • OpenGL加速
  • 缓存机制设计

详细指南: performance_optimization.md

5. 测试验证

功能: 完整的测试体系建立

覆盖范围:

  • 完整的测试用例分类(单元测试、接口测试、集成测试、UI测试、性能测试)
  • Google Test框架使用
  • 测试覆盖率目标(>90%)

详细指南: testing_strategy.md

迁移工作流程

阶段1: 需求分析和UI清单

# 1. 分析WinForms项目架构
node scripts/architecture_analyzer.js --project <路径> --output analysis.json

# 2. 建立UI功能清单(重要!)
node scripts/ui_inventory.js --project <路径> --output ui_inventory.json

# 3. 生成迁移计划
node scripts/migration_planner.js --analysis analysis.json --ui ui_inventory.json --output plan.json

# 4. 输出内容:
#    - 项目结构分析
#    - UI功能清单(字体、布局、颜色、交互等)
#    - 控件和事件清单
#    - 依赖关系图
#    - 复杂度评估

重要提示: UI功能清单是实现100% UI一致性的基础,详见 UI功能清单文档

阶段2: 设计规划

# 1. 设计分层架构
node scripts/layered_architect.js --analysis analysis.json --output architecture.json

# 2. 生成接口层
node scripts/interface_generator.js --analysis analysis.json --output interface/

# 3. 输出内容:
#    - 分层架构设计
#    - 接口层定义
#    - 数据模型设计
#    - 性能优化策略

阶段3: 代码转换

# 1. 生成Qt项目基础
node scripts/code_generator.js --mapping plan.json --output QtProject/

# 2. 转换控件和属性
node scripts/control_mapper.js --mapping plan.json --output QtProject/

# 3. 转换事件处理
node scripts/event_converter.js --mapping plan.json --output QtProject/

# 4. 迁移布局系统
node scripts/layout_migrator.js --mapping plan.json --output QtProject/

阶段4: UI一致性验证(重要!)

# 1. 像素级UI对比
node scripts/ui_compare.js --winforms WinFormsApp/ --qt QtProject/ --output ui_diff.json

# 2. 字体和颜色验证
node scripts/validate_styles.js --project QtProject/ --inventory ui_inventory.json --output style_validation.json

# 3. 交互行为验证
node scripts/validate_interactions.js --project QtProject/ --output interaction_report.json

# 4. 可折叠/隐藏功能验证
node scripts/validate_collapsible_ui.js --project QtProject/ --output collapsible_report.json

验证标准: 详见 UI一致性验证清单

阶段5: 测试验证

# 1. 生成测试代码
node scripts/test_generator.js --project QtProject/ --output tests/

# 2. 验证迁移结果
node scripts/validate_migration.js --qt-project QtProject/ --winforms-project WinFormsProject/

# 3. 性能测试
node scripts/performance_tester.js --project QtProject/ --output perf_report.json

# 4. 输出内容:
#    - 测试用例报告
#    - 覆盖率分析
#    - 性能对比
#    - 回归测试结果

常用命令速查

架构分析

# 完整分析
node scripts/architecture_analyzer.js --project ./WinFormsApp --output analysis.json

# 仅分析依赖
node scripts/architecture_analyzer.js --project ./WinFormsApp --type dependencies --output deps.json

# 仅分析复杂度
node scripts/architecture_analyzer.js --project ./WinFormsApp --type complexity --output complexity.json

代码生成

# 生成完整项目
node scripts/code_generator.js --mapping mapping.json --output QtApp/

# 仅生成接口层
node scripts/interface_generator.js --analysis analysis.json --output interface/

# 仅生成测试
node scripts/test_generator.js --project QtApp/ --output tests/

验证和优化

# 验证迁移
node scripts/validate_migration.js --qt-project QtApp/ --winforms-project WinFormsApp/

# 性能分析
node scripts/performance_analyzer.js --project QtApp/ --output perf_analysis.json

# 优化建议
node scripts/performance_optimizer.js --analysis perf_analysis.json --output optimization.json

参考文档索引

详细的迁移指南请查看 references/ 目录:

架构设计

代码转换

高级主题

性能和测试

问题解决

UI一致性(重要!)

模板和示例

项目模板

# Qt项目模板
assets/templates/qt-project-template/

# 接口层模板
assets/templates/interface-layer-template/

# 测试模板
assets/templates/test-template/

示例代码

技术支持

文档

示例

外部资源


UI 100%一致性验证指南

验证流程

迁移前
  ↓
建立UI功能清单 ← [ui_inventory_checklist.md]
  ↓
迁移实现
  ↓
像素级UI对比 ← [ui_differences.md]
  ↓
字体和颜色验证
  ↓
交互行为验证
  ↓
可折叠/隐藏功能验证 ← [collapsible_ui.md]
  ↓
100%一致 ✅

必须验证的内容

1. 外观一致性

  • ✅ 控件尺寸(像素级)
  • ✅ 控件间距(像素级)
  • ✅ 字体、颜色、样式
  • ✅ 图标、图片显示
  • ✅ 控件边框、圆角

2. 布局一致性

  • ✅ 窗体初始大小
  • ✅ 控件初始位置
  • ✅ 响应式缩放行为
  • ✅ 最小/最大尺寸
  • ✅ 停靠行为

3. 交互一致性

  • ✅ 鼠标事件响应
  • ✅ 键盘快捷键
  • ✅ Tab顺序
  • ✅ 焦点行为
  • ✅ 拖拽行为

4. 可折叠/隐藏功能

  • ✅ 面板折叠/展开
  • ✅ 标签页动态管理
  • ✅ 菜单项动态控制
  • ✅ 工具栏状态切换

验证工具

  • Screen Ruler: 像素级测量
  • PixPick: 取色器
  • Snipaste: 截图对比
  • PyAutoGUI: 自动化截图对比

常见差异修复

差异WinFormsQt修复方法
按钮圆角0px2-4pxborder-radius: 0px
表格行高23px21pxsetDefaultSectionSize(23)
滚动条宽度17px16pxsetStyleSheet("width: 17px")

重要提示: 本Skill提供的是迁移指导和辅助工具,无法实现100%自动化转换。重要的业务逻辑、复杂交互和性能优化需要人工审查和调整。

UI一致性: 实现100% UI一致性需要严格遵循UI功能清单,进行像素级验证,特别是字体、布局、颜色和可折叠/隐藏功能的细节对比。

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

Huo15 Openclaw Enhance

火一五·克劳德·龙虾增强插件 v5.7.8 — 全面适配 openclaw 2026.4.24:peerDep ^4.24 + build/compat 同步到 4.24 + 14 处 api.on 全部去掉 as any 改成 typed hook(hookName 联合类型 + handler 自动推断 Pl...

Registry SourceRecently Updated
General

Content Trend Analyzer

Aggregates and analyzes content trends across platforms to identify hot topics, user intent, content gaps, and generates data-driven article outlines.

Registry SourceRecently Updated
General

Prompt Debugger

Debug prompts that produce unexpected AI outputs — diagnose failure modes, identify ambiguity and conflicting instructions, test variations, compare model re...

Registry SourceRecently Updated
General

Indie Maker News

独行者 Daily - 变现雷达。读对一条新闻,少走一年弯路。每天5分钟,给创业者装上商业雷达。聚焦一人公司、副业、创业变现资讯,智能分类,行动导向。用户下载即能用,无需本地部署!

Registry SourceRecently Updated