Skip to content

tutorial(cpp-ui): exercise the full .rep surface beyond slots - #75

Merged
dlipicar merged 1 commit into
masterfrom
claude/cpp-ui-rep-doctest
Jun 28, 2026
Merged

tutorial(cpp-ui): exercise the full .rep surface beyond slots#75
dlipicar merged 1 commit into
masterfrom
claude/cpp-ui-rep-doctest

Conversation

@dlipicar

Copy link
Copy Markdown
Contributor

What

Part 3 of the tutorial (calc_ui_cpp) previously demonstrated only slots in its .rep. This broadens it to exercise the whole Qt Remote Objects contract a universal UI backend can author, so the tutorial teaches the breadth of .rep — properties of different types and modes, and a signal — not just call-and-return.

The .rep now declares, and the Step 9 UI test drives, each surface:

Surface .rep Driven in the UI test
Value slot SLOT(int add(int,int)) logos.watch(...)8
Void slot SLOT(void announceVersion()) fire-and-forget, no watch
READONLY QString PROP (event-fed) PROP(QString versionEvent READONLY) Version event: 1.0.0 from a typed calc_module event subscription
READONLY int PROP (slot-driven) PROP(int computeCount READONLY) Computations: 1
READWRITE int PROP PROP(int memory READWRITE) QML writes backend.memory, round-trips Memory: 0 → 8
SIGNAL SIGNAL(computed(QString op, int result)) Last op (signal): add = 8 via a Connections block

The backend gains onContextReady() (event subscription) and a private record() helper (bumps computeCount, emits computed). The QML view gains a Connections block, Computations / Last op labels, and a memory register with Store/Clear buttons. The closing Comparison: .rep Interface Patterns table now marks every row exercised except Model (left as a Next-Steps pointer), and an enum example is added to Next Steps.

Verification

Ran the executable doctest chain (Part 1 → 2 → 3) end to end via logos-doctest:

  • 69/69 steps passed, 0 failed.
  • The cpp-ui "Launch and verify the UI" step ran all 14 actions and passed — including the new Computations: 1 (READONLY PROP), Last op (signal): add = 8 (SIGNAL), and Memory: 0 → 8 (READWRITE round-trip) assertions, against a real offscreen build.
  • Regenerated outputs/ per convention: tutorial-cpp-ui-app.md, the four changed logos-calc-ui-cpp/src/* files, and the three cpp-ui screenshots (the final calc-cpp-event.png shows all five surfaces live, incl. Memory: 8 and Version event: 1.0.0).

Every new pattern mirrors existing production usage (storage-ui's Connections-to-.rep-SIGNAL; wallet-ui / blockchain-ui / basecamp writing READWRITE replica props from QML).

🤖 Generated with Claude Code

Part 3's .rep previously declared only slots. Broaden it to cover the whole
Qt Remote Objects contract a universal UI backend can author, so the tutorial
teaches the breadth of .rep, not just call-and-return:

  - SLOT(void announceVersion())             — a void / fire-and-forget slot
  - PROP(QString versionEvent READONLY)      — fed by a typed calc_module event
                                               subscription armed in onContextReady()
  - PROP(int computeCount READONLY)          — a slot-driven counter (int PROP)
  - PROP(int memory READWRITE)               — a register the QML view writes back
  - SIGNAL(computed(QString op, int result)) — a backend -> view push

The backend gains onContextReady() (event subscription) and a record() helper
(bumps computeCount, emits computed); the QML view gains a Connections block,
Computations / Last-op labels, and a Memory register with Store/Clear buttons
that assign backend.memory. Step 9's UI test drives each surface — the slot
return value, the int PROP (Computations: 1), the signal payload (add = 8),
and the READWRITE round-trip (Memory: 0 -> 8) — and the closing .rep pattern
table now marks every row exercised except Model.

Regenerated outputs/ (md + calc_ui_cpp sources + screenshots). Verified end to
end via the doctest chain (Part 1->2->3): 69/69 steps, UI test 14/14.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

📊 Tutorial execution report

Rendered tutorial alongside the commands actually run and their output (updated each run, commit 9c87fbb):

Pages can take a minute to update after the run finishes.

@dlipicar
dlipicar merged commit 7d811ec into master Jun 28, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant