How do I create Qt UI for a new entity?

Table of Contents

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):

  1. Create Client{Entity}Model.hpp / .cpp: inherit QAbstractTableModel, define Column enum, implement async fetch using QtConcurrent::run + QFutureWatcher, add pagination.
  2. Create {Entity}ListWindow.hpp / .cpp: toolbar, sort/filter proxy, table view; connect dataLoaded / loadError signals.
  3. Build: cmake --build --preset linux-clang-debug-ninja --target ores.qt.lib.

Phase 2 — detail dialog (PR: [qt] Add {Entity} detail dialog):

  1. Create {Entity}Dialog.hpp / .cpp with one editor per field, async save, accepted / rejected signals.
  2. Connect from list window: double-click / Edit button → open dialog.

Phase 3 — history dialog (PR: [qt] Add {Entity} history dialog):

  1. Create {Entity}HistoryDialog.hpp / .cpp with Client{Entity}HistoryModel loading all versions by UUID.
  2. Connect from list window: History toolbar button → open dialog.

Phase 4 — controller and integration (PR: [qt] Integrate {Entity} controller and update diagrams):

  1. Register the list window in MainWindow.cpp (menu + plugin slot).
  2. Update class diagrams with doc-add-class-diagram.
  3. 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

Emacs 29.1 (Org mode 9.6.6)