Physics Simulation & Visualization Tool 0.1
A C++ physics simulation engine with real-time 3D visualization
Loading...
Searching...
No Matches
TransformInspectorWidget Class Reference

#include <TransformInspectorWidget.h>

Inheritance diagram for TransformInspectorWidget:
[legend]
Collaboration diagram for TransformInspectorWidget:
[legend]

Public Member Functions

 TransformInspectorWidget (QWidget *parent=nullptr)
 
void load (SceneObject *object) override
 Loads and binds this section to a scene object.
 
void unload () override
 Unloads the current object and clears section state.
 
void refresh () override
 Updates UI widgets from the current object's state.
 
- Public Member Functions inherited from IInspectorSection
virtual ~IInspectorSection ()=default
 Virtual destructor for proper cleanup of derived classes.
 

Additional Inherited Members

- Protected Member Functions inherited from IInspectorSection
 IInspectorSection (QWidget *parent=nullptr)
 Protected constructor enforces use as base class only.
 

Detailed Description

Definition at line 11 of file TransformInspectorWidget.h.

Constructor & Destructor Documentation

◆ TransformInspectorWidget()

TransformInspectorWidget::TransformInspectorWidget ( QWidget *  parent = nullptr)
explicit

Definition at line 6 of file TransformInspectorWidget.cpp.

Member Function Documentation

◆ load()

void TransformInspectorWidget::load ( SceneObject object)
overridevirtual

Loads and binds this section to a scene object.

Called when an object is selected in the scene. Implementations should:

  • Store the object pointer for property access
  • Show the section if applicable to this object type
  • Initialize UI widgets with current object values via refresh()

The object pointer is guaranteed to be non-null. For clearing the selection, use unload() instead.

Parameters
objectThe scene object to inspect. Must not be nullptr.
Note
If the section doesn't apply to this object type (e.g., physics section for non-physics objects), the implementation should hide itself via setVisible(false).
See also
unload()
refresh()
InspectorWidget::loadObject()

Implements IInspectorSection.

Definition at line 14 of file TransformInspectorWidget.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ refresh()

void TransformInspectorWidget::refresh ( )
overridevirtual

Updates UI widgets from the current object's state.

Called periodically (typically every 100ms via QTimer) to keep the UI synchronized with the object's properties, which may change due to:

  • Physics simulation updates
  • Interactive gizmo manipulation
  • Numerical solver operations
  • Direct property modifications from code

Implementations should:

  • Check if an object is loaded (guard against nullptr)
  • Read current property values from the object
  • Update UI widgets using QSignalBlocker to prevent feedback loops

This is a read-only operation - it should not modify the object, only reflect its current state in the UI.

Note
Must be safe to call even if no object is loaded (should no-op).
Must use QSignalBlocker when updating widgets to prevent triggering change handlers that would write back to the object.

Example:

void MySection::refresh() {
if (!selectedObject) return; // Safe no-op when unloaded
for (auto& row : rows) {
row.refresh(); // InspectorRow handles signal blocking
}
}
See also
load()
InspectorRow::refresh()
InspectorWidget::refresh()

Implements IInspectorSection.

Definition at line 28 of file TransformInspectorWidget.cpp.

Here is the caller graph for this function:

◆ unload()

void TransformInspectorWidget::unload ( )
overridevirtual

Unloads the current object and clears section state.

Called when:

  • Selection is cleared (no object selected)
  • Before loading a new object
  • The inspected object is about to be deleted

Implementations should:

  • Clear the stored object pointer (set to nullptr)
  • Hide the section via setVisible(false)
  • Clean up any object-specific state

After unload(), the section should be in a safe state where refresh() can be called without side effects (though it typically does nothing).

See also
load()
InspectorWidget::unloadObject()

Implements IInspectorSection.

Definition at line 23 of file TransformInspectorWidget.cpp.

Here is the caller graph for this function:

The documentation for this class was generated from the following files: