1.4 KiB
1.4 KiB
Skill: Multi-System Signaling (uLib ↔ Qt)
This skill manages the coexistence of uLib::Object signals and Qt's Q_OBJECT signaling system.
Context
- uLib Signals: Used for domain logic and data changes (
uLib::Object::connect). - Qt Signals: Used for UI events, widgets, and application-level control flow (
QObject::connect).
Patterns
1. Bridging Logic
When a domain change needs to trigger a UI update, use a wrapper or a direct connection if the widget has access to the uLib::Object.
// In a Qt Widget
uLib::Object::connect(domainObj, &Object::Updated, [this]() {
this->update(); // Trigger Qt repaint
});
2. Selection Flow
Selection usually starts in the VTK Viewport (Qt) and flows to the domain context.
QViewportemitsprop3dSelected(Prop3D*)(Qt signal).MainPanelcatches it and callscontextPanel->selectObject(p->GetContent()).ContextPanelupdates the tree view and property editors.
3. Connection Hygiene
- Use
uLib::Object::connectfor everything involvinguLib::Propertychanges. - Use Qt
connectfor button clicks, menu actions, and window events. - Be careful with lambda captures; ensure the captured object is still alive or use weak pointers if necessary.
Checklist
- Is the correct signaling system being used for the task?
- Are capture groups in lambdas safe?
- Does selection flow correctly between the 3D view and the tree view?