Codegen Add QT Entity
Table of Contents
When to use this skill
When you need to add Qt desktop UI for a new entity in ores.qt.
Prerequisites: the domain type must exist (domain-type-creator) and the
server-side handlers must be implemented. See Entity lifecycle for the
full layer ordering. If real-time updates are needed, the eventing
infrastructure must also be in place.
Codegen (--profile qt) is the primary path — always try it first.
How to use this skill
- Generate with codegen (preferred):
cd projects/ores.codegen && ./run_generator.sh models/{component}/{entity}_domain_entity.json --profile qtThen go directly to Phase 4 (controller wiring). - If manual creation is needed, work through four phases:
- Phase 1 — ClientModel + list window (PR:
[qt] Add {Entity} model and list window): async model with pagination +QAbstractTableModel; list window with toolbar, sort/filter proxy, table view. - Phase 2 — detail dialog (PR:
[qt] Add {Entity} detail dialog): form editors, async save,accepted=/=rejectedsignals. - Phase 3 — history dialog (PR:
[qt] Add {Entity} history dialog): read-only versioned view via a separate history model. - Phase 4 — controller + integration (PR:
[qt] Integrate {Entity} controller and update diagrams): register inMainWindow.cpp; update class diagrams; add recipe docs.
- Phase 1 — ClientModel + list window (PR:
- Select an icon for toolbar actions using icon-guidelines.
Use feature-branch-manager between phases and pr-manager to open each PR.
Build after every step: cmake --build --preset linux-clang-debug-ninja --target ores.qt.lib.
Recipes
- How do I create Qt UI for a new entity? — codegen and manual phase-by-phase walkthrough.
Reference
- Qt entity patterns — ClientModel layout, async fetch, recency highlighting, dialog shapes, file locations.
- ORE Studio Codegen —
--profile qtdetails and template catalogue. - Qt plugin architecture — plugin lifecycle and menu registration.
- icon-guidelines — icon selection for toolbar actions.
- Entity lifecycle — layer ordering overview.
Templates
Runs via --profile qt (12 templates). Full output paths are in
Qt entity patterns§"Templates". Read the template directly for the
authoritative implementation — do not reproduce it here.
| Template | Generates |
|---|---|
cpp_qt_client_model.hpp.mustache |
Client{Entity}Model.hpp |
cpp_qt_client_model.cpp.mustache |
Client{Entity}Model.cpp |
cpp_qt_mdi_window.hpp.mustache |
{Entity}MdiWindow.hpp |
cpp_qt_mdi_window.cpp.mustache |
{Entity}MdiWindow.cpp |
cpp_qt_detail_dialog.hpp.mustache |
{Entity}DetailDialog.hpp |
cpp_qt_detail_dialog.cpp.mustache |
{Entity}DetailDialog.cpp |
cpp_qt_history_dialog.hpp.mustache |
{Entity}HistoryDialog.hpp |
cpp_qt_history_dialog.cpp.mustache |
{Entity}HistoryDialog.cpp |
cpp_qt_controller.hpp.mustache |
{Entity}Controller.hpp |
cpp_qt_controller.cpp.mustache |
{Entity}Controller.cpp |
qt_detail_dialog_ui.mustache |
{Entity}DetailDialog.ui |
qt_history_dialog_ui.mustache |
{Entity}HistoryDialog.ui |