C++ Qt templates

Table of Contents

This page is the literate source for the cpp_qt facet of the codegen template library. Each section documents one template and holds its source in a mustache block tangled to the sibling .mustache file consumed by generator.py. The .mustache files are generated artefacts — edit this document, then run the tangle (compass build --direct tangle_codegen_templates or projects/ores.lisp/src/ores-build-codegen-templates.el directly). Output paths and profile membership come from facet_catalogue.org.

Summary

Five hpp/cpp pairs generating an entity's Qt UI layer: the client model (list data + NATS-driven refresh), the controller (dialog orchestration), detail and history dialogs (paired with the .ui XML in the assets facet), and the MDI window hosting the list view. All ten belong to the qt profile; outputs target the pre-regroup projects/ores.qt.{component} layout (stale-profiles capture).

The cpp_qt facet

The Qt projection of the entity model, following the patterns in the Qt modeling docs: every entity gets the same five-class ensemble, derived from domain_entity.qt fields (detail fields, list columns, protocol class names). The dialogs load their .ui twins; the client model subscribes to the entity's NATS changed events so lists refresh live.

Mustache incantations

Field loops switch on the same widget-kind flags as the .ui templates (is_line_edit, is_check_box, is_dynamic_combo, …) to generate the matching C++ accessors; protocol and event class names arrive as explicit model fields (their derivation from conventions is the Phase-1 Qt-derivation story). Otherwise standard constructs.

Archetypes

Archetype Description
cpp_qt_client_model.cpp.mustache List model + NATS refresh wiring.
cpp_qt_client_model.hpp.mustache Client model declarations.
cpp_qt_controller.cpp.mustache Dialog lifecycle and service calls.
cpp_qt_controller.hpp.mustache Controller declarations.
cpp_qt_detail_dialog.cpp.mustache Loads the generated .ui; field get/set per widget kind.
cpp_qt_detail_dialog.hpp.mustache Detail dialog declarations.
cpp_qt_history_dialog.cpp.mustache Read-only history view over temporal rows.
cpp_qt_history_dialog.hpp.mustache History dialog declarations.
cpp_qt_mdi_window.cpp.mustache List view window hosted in the main MDI area.
cpp_qt_mdi_window.hpp.mustache MDI window declarations.

See also

  • (Parent template group doc: <group>_group.org.)
  • Codegen template library — the groups overview.
  • Facet — the MASD concept these templates project.
  • Qt facet — the facet's modeling reference.
  • Variability Model — to understand the configuration knobs these templates branch on (the masd.qt.* feature bundle: has_pagination, window_title, icon, collection_name, …), see Part 2. Computed qt.* values (detail_fields, has_badge_columns, the is_* widget predicates, …) are derived from the model, not configured.
  • Applied MASD — the facet catalogue and codegen routes.
  • facet_catalogue.org — profile → template/output mapping.

Emacs 29.1 (Org mode 9.6.6)