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

#include <PhysicsInspectorWidget.h>

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

Public Member Functions

 PhysicsInspectorWidget (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 10 of file PhysicsInspectorWidget.h.

Constructor & Destructor Documentation

◆ PhysicsInspectorWidget()

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

Definition at line 7 of file PhysicsInspectorWidget.cpp.

Member Function Documentation

◆ load()

void PhysicsInspectorWidget::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 78 of file PhysicsInspectorWidget.cpp.

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

◆ refresh()

void PhysicsInspectorWidget::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 95 of file PhysicsInspectorWidget.cpp.

Here is the caller graph for this function:

◆ unload()

void PhysicsInspectorWidget::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 90 of file PhysicsInspectorWidget.cpp.

Here is the caller graph for this function:

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