NDEVR
API Documentation
CustomModelLogic

An easy interface for adding common SoftwareInterfaces relating to a Model to the program logic. More...

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

Public Member Functions

virtual const UUIDid () const
 Returns the unique identifier for this custom model logic instance.
virtual void registerAll ()
 Registers all callbacks (context menu, tree widgets, dialog, NDV) with the manager.
const Buffer< String > & typeNames () const
 Returns the type names handled by this custom model logic.

Protected Member Functions

 CustomModelLogic (QTModelManager *manager, const Buffer< String > &type_names)
 Constructs a CustomModelLogic for multiple model type names.
 CustomModelLogic (QTModelManager *manager, const StringView &type_name)
 Constructs a CustomModelLogic for a single model type name.
virtual ~CustomModelLogic ()
 Destructor.
virtual void addMenuItems (Model &, QTModelManager *, QMenu &, const Buffer< UUID > &, const SelectionInfo &)
 Override to add custom context menu items when a model of this type is selected.
virtual bool canBeHandledBySelectionWidget () const
 Returns whether this model type can be handled by the generic selection widget.
ContextMenuCallbackcontextMenuCallback ()
 Returns the context menu callback for this model logic.
CustomDesignObjectDialogSetupCallback * dialogSetupCallback ()
 Returns the dialog setup callback for this model logic.
virtual void executeMenuItems (Model &, QTModelManager *, QAction *, const Buffer< UUID > &, const SelectionInfo &, PopupInfo)
 Override to handle execution of custom context menu actions.
NDVSetupCallbackndvFileReadLogic ()
 Returns the NDV file read setup callback for this model logic.
void setSorter (const std::function< bool(const Model &a, const Model &b)> &sort_function)
 Sets a custom sorting function for models of this type.
virtual void setTreeWidgetsForSelection (const Model &, Buffer< QWidget * > &, SceneTree *)
 Override to provide custom tree widgets shown when the model is selected.
virtual void setupModel (Model &)
 Override to perform setup when a model of this type is read from an NDV file.
virtual void setupPropertiesDialog (DesignObjectDialog *, const DynamicPointer< QTDesignObject > &)
 Override to customize property dialogs when objects of this type are created.
virtual void setupUI (WindowManager *)
 Override to set up custom UI elements for this model type.
CustomTreeWidgetstreeWidgetCallback ()
 Returns the tree widget callback for this model logic.

Protected Attributes

ContextMenuCallbackm_custom_context_menu = nullptr
 Callback for custom context menu actions.
CustomDesignObjectDialogSetupCallback * m_dialog_callback = nullptr
 Callback for customizing property dialogs.
UUID m_id
 The unique identifier for this logic instance.
QTModelManagerm_manager
 The model manager providing data context.
NDVSetupCallbackm_ndv_setup_callback = nullptr
 Callback for NDV file read setup.
CustomModelSorter * m_sorter = nullptr
 Custom sorting logic for the model type.
CustomTreeWidgetsm_tree_button_menu = nullptr
 Callback for custom tree selection widgets.
Buffer< Stringm_type_names
 The model type names handled by this logic.

Detailed Description

An easy interface for adding common SoftwareInterfaces relating to a Model to the program logic.


Can be used to easily change program behavior for a particular Model.

Definition at line 23 of file CustomModelLogic.h.

Constructor & Destructor Documentation

◆ CustomModelLogic() [1/2]

CustomModelLogic::CustomModelLogic ( QTModelManager * manager,
const StringView & type_name )
protected

Constructs a CustomModelLogic for a single model type name.

Parameters
[in]managerThe model manager providing data context.
[in]type_nameThe type name string identifying the model type.

Referenced by BuildActionProgramLogic::BuildActionProgramLogic().

◆ CustomModelLogic() [2/2]

CustomModelLogic::CustomModelLogic ( QTModelManager * manager,
const Buffer< String > & type_names )
protected

Constructs a CustomModelLogic for multiple model type names.

Parameters
[in]managerThe model manager providing data context.
[in]type_namesThe buffer of type name strings to handle.

◆ ~CustomModelLogic()

virtual CustomModelLogic::~CustomModelLogic ( )
protectedvirtual

Destructor.

Unregisters all callbacks.

Member Function Documentation

◆ addMenuItems()

virtual void CustomModelLogic::addMenuItems ( Model & ,
QTModelManager * ,
QMenu & ,
const Buffer< UUID > & ,
const SelectionInfo &  )
inlineprotectedvirtual

Override to add custom context menu items when a model of this type is selected.

Parameters
[in]modelThe model that was right-clicked (unused parameter name).
[in]managerThe model manager (unused parameter name).
[in]menuThe context menu to populate (unused parameter name).
[in]idsThe UUIDs of selected objects (unused parameter name).
[in]infoThe selection context information (unused parameter name).

Reimplemented in BuildActionProgramLogic.

Definition at line 40 of file CustomModelLogic.h.

◆ canBeHandledBySelectionWidget()

virtual bool CustomModelLogic::canBeHandledBySelectionWidget ( ) const
inlineprotectedvirtual

Returns whether this model type can be handled by the generic selection widget.

Returns
True if the selection widget should handle this type.

Reimplemented in BuildActionProgramLogic, CollimatorLogic, ImageModelLogic, and ImageModelLogic.

Definition at line 78 of file CustomModelLogic.h.

◆ contextMenuCallback()

ContextMenuCallback * CustomModelLogic::contextMenuCallback ( )
protected

Returns the context menu callback for this model logic.

Returns
The ContextMenuCallback instance.

◆ dialogSetupCallback()

CustomDesignObjectDialogSetupCallback * CustomModelLogic::dialogSetupCallback ( )
protected

Returns the dialog setup callback for this model logic.

Returns
The CustomDesignObjectDialogSetupCallback instance.

◆ executeMenuItems()

virtual void CustomModelLogic::executeMenuItems ( Model & ,
QTModelManager * ,
QAction * ,
const Buffer< UUID > & ,
const SelectionInfo & ,
PopupInfo  )
inlineprotectedvirtual

Override to handle execution of custom context menu actions.

Parameters
[in]modelThe model the action applies to (unused parameter name).
[in]managerThe model manager (unused parameter name).
[in]actionThe triggered action (unused parameter name).
[in]idsThe UUIDs of selected objects (unused parameter name).
[in]infoThe selection context information (unused parameter name).
[in]originThe popup origin for positioning dialogs (unused parameter name).

Reimplemented in BuildActionProgramLogic.

Definition at line 50 of file CustomModelLogic.h.

◆ id()

virtual const UUID & CustomModelLogic::id ( ) const
virtual

Returns the unique identifier for this custom model logic instance.

Returns
The UUID of this logic.

◆ ndvFileReadLogic()

NDVSetupCallback * CustomModelLogic::ndvFileReadLogic ( )
protected

Returns the NDV file read setup callback for this model logic.

Returns
The NDVSetupCallback instance.

◆ setSorter()

void CustomModelLogic::setSorter ( const std::function< bool(const Model &a, const Model &b)> & sort_function)
protected

Sets a custom sorting function for models of this type.

Parameters
[in]sort_functionThe comparison function returning true if a should precede b.

◆ setTreeWidgetsForSelection()

virtual void CustomModelLogic::setTreeWidgetsForSelection ( const Model & ,
Buffer< QWidget * > & ,
SceneTree *  )
inlineprotectedvirtual

Override to provide custom tree widgets shown when the model is selected.

Parameters
[in]modelThe selected model (unused parameter name).
[in]widgetsBuffer to populate with custom widgets (unused parameter name).
[in]treeThe scene tree requesting the widgets (unused parameter name).

Reimplemented in BuildActionProgramLogic.

Definition at line 68 of file CustomModelLogic.h.

◆ setupModel()

virtual void CustomModelLogic::setupModel ( Model & )
inlineprotectedvirtual

Override to perform setup when a model of this type is read from an NDV file.

Parameters
[in]modelThe model being set up (unused parameter name).

Reimplemented in BuildActionProgramLogic.

Definition at line 61 of file CustomModelLogic.h.

◆ setupPropertiesDialog()

virtual void CustomModelLogic::setupPropertiesDialog ( DesignObjectDialog * ,
const DynamicPointer< QTDesignObject > &  )
inlineprotectedvirtual

Override to customize property dialogs when objects of this type are created.

Parameters
[in]dialogThe design object dialog to modify (unused parameter name).
[in]objectThe design object being edited (unused parameter name).

Reimplemented in BuildActionProgramLogic, CollimatorLogic, ImageModelLogic, ImageModelLogic, and PaperViewModelLogic.

Definition at line 56 of file CustomModelLogic.h.

◆ setupUI()

virtual void CustomModelLogic::setupUI ( WindowManager * )
inlineprotectedvirtual

Override to set up custom UI elements for this model type.

Parameters
[in]managerThe window manager for creating UI components (unused parameter name).

Reimplemented in PaperViewModelLogic.

Definition at line 31 of file CustomModelLogic.h.

◆ treeWidgetCallback()

CustomTreeWidgets * CustomModelLogic::treeWidgetCallback ( )
protected

Returns the tree widget callback for this model logic.

Returns
The CustomTreeWidgets callback instance.

◆ typeNames()

const Buffer< String > & CustomModelLogic::typeNames ( ) const

Returns the type names handled by this custom model logic.

Returns
The buffer of type name strings.

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