Commit 715fa27
committed
fix: defer icon source resolution until component completion
1. Added QQmlParserStatus interface to DccObject to track QML component
lifecycle
2. Introduced m_componentComplete flag to track when component
construction is finished
3. Modified setIcon() to delay icon source resolution until
componentComplete() is called
4. Added updateIconSource() private method to handle icon URL resolution
logic
5. Added componentComplete() override to set completion flag and trigger
icon source update
6. Added classBegin() override as required by QQmlParserStatus interface
7. Made DccObject inherit from QQmlParserStatus and added Q_INTERFACES
macro
8. Added friend declaration for DccModel class to access private members
This fix addresses an issue where icon source resolution was attempted
during QML component construction phase when the QQmlContext might
not be fully initialized. By deferring the URL resolution until
componentComplete(), we ensure the context is properly set up,
preventing potential crashes or incorrect icon paths.
Log: Fixed icon loading issues during control center module
initialization
Influence:
1. Test icon loading for all control center modules
2. Verify icons appear correctly after QML component initialization
3. Test dynamic icon changes after component completion
4. Verify no crashes during control center startup
5. Test icon resolution with both relative and absolute paths
6. Verify icon updates when setIcon() is called after component
completion
fix: 延迟图标源解析直到组件完成
1. 为 DccObject 添加 QQmlParserStatus 接口以跟踪 QML 组件生命周期
2. 引入 m_componentComplete 标志来跟踪组件构造何时完成
3. 修改 setIcon() 方法,将图标源解析延迟到 componentComplete() 被调用时
4. 添加 updateIconSource() 私有方法来处理图标 URL 解析逻辑
5. 添加 componentComplete() 重写以设置完成标志并触发图标源更新
6. 添加 classBegin() 重写以满足 QQmlParserStatus 接口要求
7. 使 DccObject 继承自 QQmlParserStatus 并添加 Q_INTERFACES 宏
8. 为 DccModel 类添加友元声明以访问私有成员
此修复解决了在 QML 组件构造阶段尝试解析图标源时 QQmlContext 可能未完全初
始化的问题。通过将 URL 解析延迟到 componentComplete(),我们确保上下文已
正确设置,防止潜在的崩溃或错误的图标路径。
Log: 修复控制中心模块初始化期间的图标加载问题
Influence:
1. 测试所有控制中心模块的图标加载
2. 验证 QML 组件初始化后图标是否正确显示
3. 测试组件完成后的动态图标更改
4. 验证控制中心启动期间无崩溃
5. 测试相对路径和绝对路径的图标解析
6. 验证组件完成后调用 setIcon() 时的图标更新1 parent 68441da commit 715fa27
3 files changed
Lines changed: 41 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
331 | 332 | | |
332 | 333 | | |
333 | 334 | | |
334 | | - | |
335 | | - | |
336 | | - | |
337 | | - | |
338 | | - | |
339 | | - | |
340 | 335 | | |
341 | | - | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
342 | 340 | | |
343 | 341 | | |
344 | 342 | | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
345 | 354 | | |
346 | 355 | | |
347 | 356 | | |
| |||
488 | 497 | | |
489 | 498 | | |
490 | 499 | | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
491 | 512 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
13 | | - | |
| 14 | + | |
| 15 | + | |
14 | 16 | | |
15 | 17 | | |
| 18 | + | |
16 | 19 | | |
17 | 20 | | |
18 | 21 | | |
| |||
118 | 121 | | |
119 | 122 | | |
120 | 123 | | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
121 | 129 | | |
122 | 130 | | |
123 | 131 | | |
| |||
162 | 170 | | |
163 | 171 | | |
164 | 172 | | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
165 | 176 | | |
166 | 177 | | |
167 | 178 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| 73 | + | |
73 | 74 | | |
74 | 75 | | |
75 | 76 | | |
| |||
0 commit comments