Inside moc: Q_OBJECT, QMetaObject String Tables & qt_static_metacall
Open a generated moc_*.cpp file and trace every layer—from qt_meta_stringdata offset/length tables and base-subtracted method IDs to void *_a[] stack marshaling and QMetaObject::activate.
What you'll learn
- Expand
Q_OBJECT,signals:,slots:, andemitto the exact C++20 declarations compiled byg++. - Trace
void *_a[]layout (_a[0]return pointer +_a[1..N]stack argument pointers) from signal call site throughQMetaObject::activateintoqt_static_metacall. - Calculate global-to-local method index subtraction across multi-level
QObjectinheritance hierarchies.
Zero Compiler Magic: How Signals Become Ordinary C++ Function Calls
Newcomers to Qt often treat signals:, slots:, and emit like magical language extensions hidden inside a patched C++ compiler. Open <qtmetamacros.h> and the mystery vanishes in three lines: #define emit, #define slots, and #define signals public! When g++ compiles emit readingUpdated(kPa, faultMask);, the emit token disappears completely during preprocessing, leaving a plain C++ member function call this->readingUpdated(kPa, faultMask);.
Where does the body of PressureSensor::readingUpdated come from if you only wrote its prototype in pressure_meta.hpp? moc writes that C++ function body inside moc_pressure_meta.cpp! Alongside a read-only qt_meta_stringdata offset/length table in .rodata, moc emits the signal body—packing stack pointers into void *_a[] = { nullptr, ... } and calling QMetaObject::activate—plus qt_static_metacall, a direct switch (_id) jump table casting _a[1..N] back to typed C++ arguments.
Figure 2.3a. Same-thread DirectConnection signal emission allocates zero heap bytes: receivers read arguments directly off the sender's stack via void *_a[].
mental model: moc acts like an in-process RPC stub generator: you write clean C++ function prototypes under signals:, and moc writes the marshaling stub that bundles local stack variable addresses into an indexed void *_a[] envelope and hands it to the QMetaObject::activate switchboard.
Where it stops working: Unlike network RPC stubs that serialize bytes onto a wire, same-thread Qt::DirectConnection passes raw stack addresses (&_t1, &_t2) in _a[]; only when QMetaObject::activate crosses a thread boundary (Qt::QueuedConnection) does Qt allocate a QMetaCallEvent and copy-construct each parameter via QMetaType.
definition (, qt_meta_stringdata, and qt_static_metacall): QMetaObject is a constexpr/.rodata descriptor emitted once per Q_OBJECT class linking to superdata (&Base::staticMetaObject), qt_meta_stringdata (a single contiguous character buffer indexed by { uint32_t offset, uint32_t len } pairs in Qt 6), qt_meta_data (method flags, arity, and QMetaType arrays), and qt_static_metacall(QObject *, Call, int _id, void **_a), a static function pointer dispatching local method IDs without virtual-table growth per slot.
- Step 1. Inspect how Q_OBJECT declares staticMetaObject, two virtual hooks, and one static dispatcher.
- Step 2. Read qt_meta_stringdata's {offset, size} pairs indexing one contiguous NUL-separated char array.
- Step 3. Trace the -generated signal body packing nullptr at _a[0] and operand addresses at _a[1..N].
- Step 4. Follow peeling off base method counts until qt_static_metacall hits the local case.
Figure 2.3b. Signals pack {nullptr, &arg1..&argN} into void *_a[] and dispatch via base-subtracted metacall IDs.
Dissecting moc_*.cpp Byte-for-Byte: String Tables, _a[] & Inheritance
Why did Qt introduce qt_static_metacall instead of making every single slot a C++ virtual function? Count the cost: an application with 300 widgets and 40 slots per widget would bloat every vtable by 40 pointers and pay dynamic relocation fixups at ELF load time! Instead, Q_OBJECT adds a fixed two-method virtual footprint (metaObject() and qt_metacall()), while qt_static_metacall compiles all signals, slots, and properties of a class into one compact static switch (_id) statement.
Examine pressure_meta.hpp below, which pairs a Qt 6.8 PressureSensor class with the exact annotated C++ code moc emits into moc_pressure_meta.cpp. Notice two critical invariants: first, in scaleReading (local ID 1), returning std::int32_t writes through *reinterpret_cast<std::int32_t *>(_a[0]) = _r ONLY after checking if (_a[0]); second, qt_meta_stringdata stores { byteOffset, byteLen } pairs in offsetsAndSizes so moc never calls strlen or malloc during startup!
Figure 2.3b. Base-class offset subtraction lets moc generate Derived's switch(0..K-1) without knowing future changes to QObject's method count.
| Meta-Object Artifact | Generated Location & Storage | Runtime Cost | Role in Signal/Slot Dispatch |
|---|---|---|---|
#define signals public / #define emit | <qtmetamacros.h> preprocessor tokens | 0 ns (erased before C++ AST) | Exposes &Class::sig to PMF connect and turns emit into a call |
qt_meta_stringdata_<Class> | moc_*.cpp constexpr .rodata struct | 0 heap bytes; XIP/page-cache shared | Provides class, signal, and slot names for introspection |
void *_a[] stack vector | Inside moc-generated signal C++ body | Stack pointer stores only (DirectConnection) | Passes return storage (_a[0]) and operand addresses (_a[1..N]) |
qt_static_metacall | moc_*.cpp static private member function | Direct C++ switch (_id) jump | Unpacks _a[1..N] and invokes the concrete C++ slot/signal |
learner@ksa:~/gl-q01/m02-l03$ bat -H 16 -H 45 pressure_meta.hpp File: pressure_meta.hpp #pragma once #include <QObject> #include <cstdint> namespace hmi { class PressureSensor : public QObject { Q_OBJECT public: explicit PressureSensor(QObject *parent = nullptr) : QObject(parent) {} void ingestSample(std::int32_t kPa, std::uint32_t faultMask) { if (kPa != m_lastKpa || faultMask != m_lastMask) { m_lastKpa = kPa; m_lastMask = faultMask; emit readingUpdated(kPa, faultMask); } } public slots: std::int32_t scaleReading(std::int32_t kPa, std::int32_t factor) const noexcept { return (kPa - m_tareKpa) * factor; } signals: void readingUpdated(std::int32_t kPa, std::uint32_t faultMask); private: std::int32_t m_lastKpa = 0; std::int32_t m_tareKpa = 101; std::uint32_t m_lastMask = 0; }; } // namespace hmi /* * Annotated excerpt of moc_pressure_meta.cpp generated by Qt 6.8 moc: * * void hmi::PressureSensor::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) { * auto *_t = static_cast<PressureSensor *>(_o); * if (_c == QMetaObject::InvokeMetaMethod) { * switch (_id) { * case 0: _t->readingUpdated((*reinterpret_cast<std::add_pointer_t<std::int32_t>>(_a[1])), * (*reinterpret_cast<std::add_pointer_t<std::uint32_t>>(_a[2]))); break; * case 1: { std::int32_t _r = _t->scaleReading((*reinterpret_cast<std::add_pointer_t<std::int32_t>>(_a[1])), * (*reinterpret_cast<std::add_pointer_t<std::int32_t>>(_a[2]))); * if (_a[0]) *reinterpret_cast<std::int32_t *>(_a[0]) = std::move(_r); } break; * default: ; * } * } * } * * void hmi::PressureSensor::readingUpdated(std::int32_t _t1, std::uint32_t _t2) { * void *_a[] = { nullptr, * const_cast<void *>(reinterpret_cast<const void *>(std::addressof(_t1))), * const_cast<void *>(reinterpret_cast<const void *>(std::addressof(_t2))) }; * QMetaObject::activate(this, &staticMetaObject, 0, _a); * } */- emit disappears in preprocessing; readingUpdated(kPa, faultMask) calls the moc-emitted C++ body below.
- Non-void slot case 1 guards if (_a[0]) before writing _r because void signal connections pass _a[0] == nullptr.
moc(1) GL-Q01 Quick Reference moc(1) NAME moc, QMetaObject::activate, qt_static_metacall - Qt 6 meta-object dispatch SYNOPSIS moc [options] <header>.hpp -o moc_<header>.cpp static void QMetaObject::activate(QObject *sender, const QMetaObject *m, int local_signal_index, void **argv); CALLING CONVENTION (void **argv) argv[0] Pointer to return value storage, or nullptr when ignored / void. argv[1] Address of parameter 1 (const void * cast to void *). argv[k] Address of parameter k. INHERITANCE INDEXING Derived::qt_metacall calls _id = Base::qt_metacall(_c, _id, _a). When _id >= 0, Base has subtracted its method count so Derived switches on local 0..count-1. Kernel Systems Academy Lesson 2.3 moc(1) GL-Q01 quick reference · full manual page: man 1 moc Constructing a Packed String-Table and void** Meta-Object Engine in C++20
In verify.cpp, we build a faithful C++20 miniature of moc's generated tables: a constexpr MetaStringData table indexing one contiguous character buffer via {offset, len} pairs, a two-level MetaBase -> DerivedSensor hierarchy implementing qt_metacall base-offset subtraction, and activate() routing void *_a[] argument packs.
Verify every step of main(): string_at(1) slices "readingUpdated" without heap allocation, emitting reading_updated(245, 0x04U) forwards stack pointers through _a[1] and _a[2] into rx, and invoking global method ID 2 (scale_reading) writes 3100 directly into ret through _a[0]!
learner@ksa:~/gl-q01/m02-l03$ bat -H 25 -H 127 verify.cpp File: verify.cpp #include <array> #include <cassert> #include <cstdint> #include <cstdio> #include <memory> #include <string_view> #include <vector> namespace hmi { struct OffsetLen { std::uint32_t offset; std::uint32_t len; }; template <std::size_t NStrings, std::size_t BufSize> struct PackedMetaStrings { std::array<OffsetLen, NStrings> index; char chars[BufSize]; constexpr std::string_view at(std::size_t i) const noexcept { return std::string_view(chars + index[i].offset, index[i].len); } }; static constexpr PackedMetaStrings<3, 44> kSensorStrings = { {{{0, 13}, {14, 14}, {29, 12}}}, "DerivedSensor\0readingUpdated\0scaleReading\0" }; class MetaBase; using StaticMetacallFn = void (*)(MetaBase *, int local_id, void **a); struct MetaObject { const MetaObject *super; int method_offset; int method_count; StaticMetacallFn static_metacall; }; struct Connection { int global_sig_id; MetaBase *receiver; int global_slot_id; }; class MetaBase { public: virtual ~MetaBase() = default; virtual int qt_metacall(int id, void **a) { if (id < 0) { return id; } if (id < 1) { if (id == 0) { ++reset_count; (void)a; } return -1; } return id - 1; } void connect_raw(int global_sig, MetaBase *rx, int global_slot) { m_conns.push_back({global_sig, rx, global_slot}); } static void activate(MetaBase *sender, const MetaObject *mo, int local_sig_id, void **a) { const int global_sig = mo->method_offset + local_sig_id; for (const auto &c : sender->m_conns) { if (c.global_sig_id == global_sig && c.receiver) { c.receiver->qt_metacall(c.global_slot_id, a); } } } int reset_count = 0; private: std::vector<Connection> m_conns; }; class DerivedSensor final : public MetaBase { public: static const MetaObject kMeta; int qt_metacall(int id, void **a) override { id = MetaBase::qt_metacall(id, a); if (id < 0) { return id; } if (id < kMeta.method_count) { qt_static_metacall(this, id, a); return -1; } return id - kMeta.method_count; } void reading_updated(std::int32_t kpa, std::uint32_t mask) { void *a[] = { nullptr, const_cast<void *>(reinterpret_cast<const void *>(std::addressof(kpa))), const_cast<void *>(reinterpret_cast<const void *>(std::addressof(mask))), }; MetaBase::activate(this, &kMeta, 0, a); } std::int32_t scale_reading(std::int32_t kpa, std::uint32_t mask) { last_kpa = kpa; last_mask = mask; return kpa * 10; } std::int32_t last_kpa = 0; std::uint32_t last_mask = 0; private: static void qt_static_metacall(MetaBase *o, int local_id, void **a) { auto *self = static_cast<DerivedSensor *>(o); switch (local_id) { case 0: self->reading_updated( *reinterpret_cast<const std::int32_t *>(a[1]), *reinterpret_cast<const std::uint32_t *>(a[2])); break; case 1: { const std::int32_t r = self->scale_reading( *reinterpret_cast<const std::int32_t *>(a[1]), *reinterpret_cast<const std::uint32_t *>(a[2])); if (a[0]) { *reinterpret_cast<std::int32_t *>(a[0]) = r; } break; } default: break; } } }; static const MetaObject kBaseMeta{nullptr, 0, 1, nullptr}; const MetaObject DerivedSensor::kMeta{&kBaseMeta, 1, 2, &DerivedSensor::qt_static_metacall}; } // namespace hmi int main() { static_assert(hmi::kSensorStrings.at(0) == "DerivedSensor"); static_assert(hmi::kSensorStrings.at(1) == "readingUpdated"); static_assert(hmi::kSensorStrings.at(2) == "scaleReading"); hmi::DerivedSensor tx; hmi::DerivedSensor rx; tx.connect_raw(1, &rx, 2); // global sig 1 -> global slot 2 (local case 1) tx.reading_updated(245, 0x04U); assert(rx.last_kpa == 245 && rx.last_mask == 0x04U); std::int32_t ret = 0; std::int32_t in_kpa = 310; std::uint32_t in_mask = 0U; void *call_args[] = {&ret, &in_kpa, &in_mask}; assert(rx.qt_metacall(2, call_args) == -1 && ret == 3100); void *empty_args[] = {nullptr}; assert(rx.qt_metacall(0, empty_args) == -1 && rx.reset_count == 1); std::printf("moc sig='%.*s' rx_kpa=%d mask=0x%x ret=%d base_reset=%d\n", static_cast<int>(hmi::kSensorStrings.at(1).size()), hmi::kSensorStrings.at(1).data(), rx.last_kpa, rx.last_mask, ret, rx.reset_count); return 0; }- PackedMetaStrings models Qt 6 qt_meta_stringdata in constexpr .rodata with zero startup heap allocations.
- qt_static_metacall checks if (a[0]) before writing return value r so void signal emissions with a[0]==nullptr never crash.
Verifying String Table Slicing and void** Metacall Return Values
Confirm ./verify prints moc sig='readingUpdated' rx_kpa=245 mask=0x4 ret=3100 base_reset=1. Notice that tx.reading_updated(245, 0x04U) invoked scale_reading with a[0] == nullptr (safely ignoring the return value), whereas direct rx.qt_metacall(2, call_args) passed &ret in a[0] and captured ret=3100!
Next time you inspect an embedded crash dump in gdb and see QMetaObject::activate -> qt_static_metacall between a button click and your slot, you can read _id and ((int*)_a[1])[0] directly off the register/stack frame!
learner@ksa:~/gl-q01/m02-l03g++ -std=c++20 -Wall -Wextra -Werror -pedantic verify.cpp -o verifylearner@ksa:~/gl-q01/m02-l03./verifymoc sig='readingUpdated' rx_kpa=310 mask=0x0 ret=3100 base_reset=1learner@ksa:~/gl-q01/m02-l03learner@ksa:~/gl-q01/m02-l03strace -e trace=write,exit_group ./verifywrite(1, "moc sig='readingUpdated' rx_kpa="..., 67) = 67exit_group(0) = ?+++ exited with 0 +++Custom QMetaType Registration & Hand-Written Signal Pitfalls
Module 2 has demystified Qt 6's binary and compile-time machinery: d_ptr/q_ptr ABI insulation, atomic Copy-on-Write QArrayDataPointer discipline, uic .ui-to-C++ lowering, and moc qt_meta_stringdata plus qt_static_metacall void **_a activation.
Proceed to the lab_m02_moc_signal_dispatch studio below to repair a multi-slot MetaEndpoint router supporting packed string introspection, block_signals(bool) prior-state restoration, and re-entrant mid-dispatch slot disconnection.
Writing a Hand-Coded Function Body for a Method Declared Under signals:
- Symptom: Linker aborts with
multiple definition of 'hmi::PressureSensor::readingUpdated(int, unsigned int)'betweenpressure_meta.cpp.oandmocs_compilation.cpp.o. - Root Cause:
mocALWAYS emits the C++ function body for every prototype listed undersignals:; providing a second body in your.cppfile violates the C++ One Definition Rule (ODR). - Fix: Leave
signals:entries strictly as declarations in your.hppfile and letmocgenerate theirQMetaObject::activatebodies.
Passing Unregistered Custom Structs Across Cross-Thread QueuedConnection:
- Symptom: A signal carrying
const CanPayload &works on same-threadDirectConnection, then silently fails at runtime withQObject::connect: Cannot queue arguments of type 'CanPayload'when moved to a workerQThread. - Root Cause: Same-thread
DirectConnectiononly forwards&payloadin_a[1], whereasQueuedConnectionmust heap-cloneCanPayloadviaQMetaTypeafter the sender returns! - Fix: Ensure custom payload structs are default/copy-constructible value types and declare
Q_DECLARE_METATYPE(CanPayload)(plusqRegisterMetaType<CanPayload>()if matched by string name).
Guided Practice
Add a third inheritance level CalibratedSensor : public DerivedSensor to verify.cpp with method_offset = 3 and method_count = 1, and trace how calling qt_metacall(3, args) peels off 1 in MetaBase and 2 in DerivedSensor before hitting local case 0 in CalibratedSensor.
Independent Practice
Open labs/lab_m02_moc_signal_dispatch/ and repair all three defects in starter/core.cpp—off-by-one _a[0] argument indexing, broken block_signals() return state, and iterator corruption on mid-emission disconnect_id()—so sh check.sh passes 5/5 TAP version 13 checks.
Verification Checks
→ open standalone lab workbench
1. Motivation
Debugging subtle Qt 6 signal bugs—nested QSignalBlocker scopes prematurely unblocking an editor, custom qt_metacall bridges miscalculating base method offsets, or one-shot slots disconnecting themselves mid-emission—requires mechanical mastery of moc dispatch. In this studio you repair a zero-allocation PackedStringTable and MetaEndpoint void ** router.
2. Learning objectives
- Resolve packed
.rodatastring slices and subtractm_offsetaccurately inMetaEndpoint::qt_metacallandactivate. - Return the prior boolean state from
MetaEndpoint::block_signals(bool)so nested signal blockers restore state without leaks. - Preserve iteration safety when a connected slot calls
disconnect_id()on its own connection duringactivate().
3. Environment requirements
All automated verification steps run in unprivileged user space on a POSIX Linux host using g++ -std=c++20 -Wall -Wextra -Werror -pedantic and clock_gettime(CLOCK_MONOTONIC). Recorded transcripts in captures.json were generated on x86_64 running kernel 7.0.0-42-generic and prove protocol, state-machine, and memory invariants only. Physical bus timing, DMA cache coherency, and board peripheral behavior require target validation on Linux kernel 6.12 LTS (ARMv7-A Cortex-A7).
4. Required software and hardware
- Host workstation:
g++(-std=c++20 -Wall -Wextra -Werror -pedantic), GNUmake,ar(binutils), and POSIX/bin/sh. - Target environment (optional hardware step, Section 13):
ARMv7-ACortex-A7target runningLinux kernel6.12 LTS and Qt 6.8 to inspect.rodataqt_meta_stringdatasymbols viaarm-linux-gnueabihf-objdump -s -j .rodataand traceqt_static_metacallingdbserver.
5. Complete executable commands
learner@ksa:~/gl-q01/m02-l03$ bat script.sh File: script.sh make -B -C files ./files/lab_cli ./files/lab_cli --bench sh check.sh6. Annotated source code
files/core.cpp enforces the production invariants that starter/core.cpp breaks:
learner@ksa:~/gl-q01/m02-l03$ bat example.cpp File: example.cpp bool MetaEndpoint::block_signals(bool block) noexcept { const bool previous = m_blocked; m_blocked = block; return previous; // Essential for nested QSignalBlocker scopes! } int MetaEndpoint::qt_metacall(int global_id, void **args) { ... const int local_id = global_id - m_offset; if (local_id < m_count) { if (m_fn) m_fn(this, local_id, args); return -1; } return local_id - m_count; }starter/core.cpp contains three meta-object bugs: (1) qt_metacall() forgets to subtract m_offset from global_id; (2) block_signals(bool) returns the newly assigned m_blocked flag instead of the previous state, breaking nested blocker restoration; and (3) activate() omits m_offset when computing global_sig.
7. Expected output
Passing files/ run (sh check.sh, exit code 0):
learner@ksa:~/gl-q01/m02-l03$ bat listing.txt File: listing.txt TAP version 13 1..5 ok 1 - builds libcore.a and lab_cli cleanly with -std=c++20 -Wall -Wextra -Werror -pedantic ok 2 - archives core.o into libcore.a and links independent TAP verifier ok 3 - slices PackedStringTable without heap copies and subtracts m_offset in qt_metacall ok 4 - returns previous blocked state from block_signals(bool) and suppresses emissions ok 5 - delivers multi-slot void** packs safely across re-entrant mid-dispatch self-disconnect # pass 5/5CLI verification output (./files/lab_cli):
learner@ksa:~/gl-q01/m02-l03$ bat listing.txt File: listing.txt str_idx=1 rx_acc=427 scaled_ret=60Defective starter/ run (exit code 1): emits FAIL: diagnostics on the broken contract assertions.
8. Explanation of observed behavior
Restoring base-offset arithmetic and prior-state preservation in files/core.cpp allows sh check.sh to compile libcore.a cleanly under -std=c++20 -Wall -Wextra -Werror -pedantic and pass all 5/5 TAP version 13 verification checks.
9. Experiment variations
- Near transfer: Write a 12-line RAII
SignalBlockerclass wrappingMetaEndpoint &that callsm_prev = ep.block_signals(true)in its constructor andep.block_signals(m_prev)in its destructor, proving nested scopes work automatically. - Far transfer: Extend
MetaEndpoint::connect_towith abool unique_connectionflag modelingQt::UniqueConnectionthat rejects duplicate(global_signal_id, receiver, global_slot_id)tuples.
10. Performance measurements
Recorded host benchmark (./files/lab_cli --bench, CLOCK_MONOTONIC, warmup=5, N=40 batches):
learner@ksa:~/gl-q01/m02-l03$ bat listing.txt File: listing.txt BENCH lab_m02_moc_signal_dispatch clock=CLOCK_MONOTONIC benchmark_samples=40 warmup=5 p50_ns=55 p95_ns=56 p99_ns=68 sink=112365000The CLOCK_MONOTONIC --bench percentiles measure two synchronous void ** metacall dispatches plus one packed string lookup per iteration in host RAM (p50 tens of nanoseconds). Never extrapolate host DirectConnection speed to cross-thread QueuedConnection heap marshaling or target ARMv7-A eventfd kernel wakeups.
11. Troubleshooting
| Symptom | Root cause | Fix |
|---|---|---|
not ok 3 - slices PackedStringTable... | qt_metacall or activate omitted m_offset conversion between global and local IDs. | Compute local_id = global_id - m_offset in qt_metacall and global_sig = m_offset + local_signal_id in activate. |
not ok 4 - returns previous blocked state... | block_signals(true) returned true on the first call instead of the prior false value. | Capture const bool previous = m_blocked; before overwriting m_blocked = block; and return previous;. |
not ok 5 - delivers multi-slot void** packs... | activate() failed to match global_sig or invalidated m_links while iterating. | Add m_offset + local_signal_id and iterate over the snapshot ID vector before erasing inactive links. |
12. Guided questions
- Why does
MetaEndpoint::activate()snapshot matching connection IDs before invokinglnk.receiver->qt_metacall(...)instead of ranging directly overm_links?
- *Hint 1:* What happens to
std::vector<Link>::iteratorif a slot invoked insideqt_metacallcallssender->connect_to(...)and triggers a vector reallocation? - *Hint 2:* Calling
connect_toinside an active slot can reallocatem_links's backing buffer, immediately invalidating raw iterators or references intom_links!
- Why does Qt's
QObject::blockSignals(bool)return the PREVIOUS boolean state rather thanvoid?
- *Hint 1:* Imagine function
outer()blocks signals, calls helperinner()which also temporarily blocks and unblocks signals, and thenouter()continues. - *Hint 2:* If
inner()unconditionally calledblockSignals(false)on exit instead ofblockSignals(previous), it would prematurely re-enable signals whileouter()still expects them blocked!
13. Independent challenges
Add a QueuedEnvelope ring queue to MetaEndpoint that deep-copies two int32_t arguments out of void **args when a connection is marked queued = true, and drains queued metacalls later after the sender's stack frame has returned.
14. Solutions and explanations
The reference files/core.cpp computes local_id = global_id - m_offset in qt_metacall(), global_sig = m_offset + local_signal_id in activate(), and preserves const bool previous = m_blocked in block_signals().
Run locally in your terminal and check off each verification milestone.
Not started
Key takeaways
- In
<qtmetamacros.h>,emitexpands to nothing,slotsexpands to nothing, andsignalsexpands topublicso callers can pass&Sender::signalNameinto PMFQObject::connect. - Emitting a
Q_OBJECTsignal invokes amoc-generated C++ member function that packs operand addresses intovoid *_a[](_a[0]return storage,_a[1..N]argument addresses) and callsQMetaObject::activate. mocpacks class, signal, slot, and parameter names into one contiguous.rodataqt_meta_stringdataoffset/length table alongsideqt_meta_datainteger method descriptors, requiring zero startup heap allocations.qt_metacalldelegates toSuperClass::qt_metacallfirst, subtracting each base class's method count from_idsoqt_static_metacallswitches on a zero-based local method index.