How do I create Qt UI for a new entity?
ClientModel layout, async fetch pattern, and file locations are in
Qt entity patterns. The codegen-add-qt-entity skill drives this process;
codegen (--profile qt) is the primary path.
Question
How do I add Qt UI components for a new entity in ores.qt?
Answer
Codegen path (preferred):
./compass.sh codegen entity generate <entity> --profile qt
Preview changes before writing:
./compass.sh codegen entity generate <entity> --profile qt --diff
Then proceed to Phase 4 (controller wiring) below.
Manual path (phases):
Phase 1 — ClientModel + list window
(PR: [qt] Add {Entity} model and list window):
- Create
Client{Entity}Model.hpp/.cpp: inheritQAbstractTableModel, defineColumnenum, implement async fetch usingQtConcurrent::run+QFutureWatcher, add pagination. - Create
{Entity}ListWindow.hpp/.cpp: toolbar, sort/filter proxy, table view; connectdataLoaded/loadErrorsignals. - Build:
cmake --build --preset linux-clang-debug-ninja --target ores.qt.lib.
Phase 2 — detail dialog (PR: [qt] Add {Entity} detail dialog):
- Create
{Entity}Dialog.hpp/.cppwith one editor per field, async save,accepted/rejectedsignals. - Connect from list window: double-click / Edit button → open dialog.
Phase 3 — history dialog (PR: [qt] Add {Entity} history dialog):
- Create
{Entity}HistoryDialog.hpp/.cppwithClient{Entity}HistoryModelloading all versions by UUID. - Connect from list window: History toolbar button → open dialog.
Phase 4 — controller and integration
(PR: [qt] Integrate {Entity} controller and update diagrams):
- Register the list window in
MainWindow.cpp(menu + plugin slot). - Update class diagrams with doc-add-class-diagram.
- Add recipe docs under
doc/recipes/qt/.
Tested by
Launch ores.qt, navigate to the entity list; verify async loading,
pagination, add/edit/delete via dialogs, history view, and recency
highlighting.
See also
- Qt entity patterns — ClientModel, dialog, history dialog patterns.
- codegen-add-qt-entity — skill that drives this workflow.
- Qt plugin architecture — plugin lifecycle and menu registration.
- Entity lifecycle — layer ordering overview.