tutorial(cpp-ui): exercise the full .rep surface beyond slots - #75
Merged
Conversation
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>
📊 Tutorial execution reportRendered tutorial alongside the commands actually run and their output (updated each run, commit Pages can take a minute to update after the run finishes. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
.repnow declares, and the Step 9 UI test drives, each surface:.repSLOT(int add(int,int))logos.watch(...)→8SLOT(void announceVersion())watchQStringPROP (event-fed)PROP(QString versionEvent READONLY)Version event: 1.0.0from a typedcalc_moduleevent subscriptionintPROP (slot-driven)PROP(int computeCount READONLY)Computations: 1intPROPPROP(int memory READWRITE)backend.memory, round-tripsMemory: 0 → 8SIGNAL(computed(QString op, int result))Last op (signal): add = 8via aConnectionsblockThe backend gains
onContextReady()(event subscription) and a privaterecord()helper (bumpscomputeCount,emitscomputed). The QML view gains aConnectionsblock,Computations/Last oplabels, 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:Computations: 1(READONLY PROP),Last op (signal): add = 8(SIGNAL), andMemory: 0 → 8(READWRITE round-trip) assertions, against a real offscreen build.outputs/per convention:tutorial-cpp-ui-app.md, the four changedlogos-calc-ui-cpp/src/*files, and the three cpp-ui screenshots (the finalcalc-cpp-event.pngshows all five surfaces live, incl.Memory: 8andVersion 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