Qt 6.12
Last reviewed Oct 25, 2026
Prompt Details
Prompt Composition
2prompts
- C++ C++23130 lines · 3.5K tokens
- Qt 6.1255 lines · 2.5K tokens
Total185 lines · 6K tokens
CWE Coverage
- 14
- 15
- 20
- 22
- 59
- 78
- 89
- 91
- 95
- 116
- 117
- 125
- 129
- 131
- 134
- 190
- 195
- 197
- 201
- 208
- 209
- 214
- 252
- 287
- 295
- 319
- 321
- 338
- 347
- 352
- 362
- 367
- 377
- 409
- 415
- 416
- 426
- 427
- 457
- 476
- 488
- 489
- 494
- 502
- 522
- 532
- 611
- 674
- 732
- 749
- 758
- 770
- 772
- 776
- 787
- 807
- 829
- 833
- 862
- 916
- 918
- 923
- 1240
- 1395
Prompt Preview
Apply the C++23 prompt first. These rules cover Qt 6.12 applications and the optional Qt modules they use. The C++23 pack is an application baseline; Qt's general minimum is C++17. Match the deployed Qt modules, plugins, compiler ABI, build configuration, and supported platform combination.
Object lifetime and QML
- Give each
QObjecta clear owner. Connect state-capturing lambdas with a receiver context, and useQPointerfor non-owning references; neither protects other captured objects or makes cross-thread access safe. - Keep parent and child
QObjects in the same thread. Deliver mutable work to its owner's thread, and checkmoveToThread()results. ArrangedeleteLater()cleanup while the appropriate event loop can still process it. - Treat queued signals, replies, and worker results as stale after logout, cancellation, or object replacement; check an operation generation and authorize the effect again at delivery.
disconnect()may leave queued deliveries pending. - Load only trusted QML and JavaScript through
QQmlComponent,Loader,Qt.createQmlObject(), orQJSEngine::evaluate(). QML has no isolation boundary for hostile code; a remote HTTPS URL alone does not make it trusted. - Expose the smallest useful set of C++ properties and invokable methods to QML. Validate and authorize privileged operations in C++, including calls made without the intended UI path.
- Keep
QQmlEngineimport and plugin paths under trusted application control. Review relative imports, environment paths, andqmldirfiles; excludeQT_QML_DEBUGand QML debugger