SMTK  @SMTK_VERSION@
Simulation Modeling Tool Kit
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
smtk::extension::qtDiagramViewMode Class Reference

An object to handle modal interaction in a diagram view. More...

#include <qtDiagramViewMode.h>

Inheritance diagram for smtk::extension::qtDiagramViewMode:
[legend]
Collaboration diagram for smtk::extension::qtDiagramViewMode:
[legend]

Public Types

using Superclass = QObject
 

Public Member Functions

 qtDiagramViewMode (smtk::string::Token modeName, qtDiagram *diagram, QToolBar *toolbar, QActionGroup *modeGroup)
 Construct a mode for diagram and add it to toolbar and modeGroup.
 
QAction * modeAction () const
 
bool isModeActive () const
 

Protected Member Functions

virtual void sceneCleared (qtDiagramGenerator *=nullptr)
 This method is called by diagram generators as the scene is cleared. More...
 
virtual void exitMode ()
 This method is called by the diagram as the mode is being changed away from this class. More...
 
virtual void enterMode ()
 This method is called by the diagram as the mode is being changed to this class. More...
 
virtual void updateFromOperation (std::unordered_set< smtk::resource::PersistentObject * > &created, std::unordered_set< smtk::resource::PersistentObject * > &modified, std::unordered_set< smtk::resource::PersistentObject * > &expunged, const smtk::operation::Operation &operation, const smtk::operation::Operation::Result &result)
 This method is called by the diagram when an operation is observed. More...
 
bool removeSelectedObjects ()
 A method subclasses may call to invoke deleters on the view's selection.
 

Protected Attributes

smtk::string::Token m_modeName
 
qtDiagramm_diagram { nullptr }
 
QAction * m_modeAction { nullptr }
 

Friends

class qtDiagram
 
class qtDiagramGenerator
 

Detailed Description

An object to handle modal interaction in a diagram view.

Subclasses of this object control how objects in the QSceneGraph respond to user input by installing event filters and setting item flags.

This base class provides the functionality to create a QAction for a QActionGroup that is inserted into the view's QToolBar to switch modes. When the action is invoked, a mode change is requested (and the mode becomes active at some later point after any prior mode has an opportunity to finalize itself).

Member Function Documentation

◆ enterMode()

virtual void smtk::extension::qtDiagramViewMode::enterMode ( )
inlineprotectedvirtual

This method is called by the diagram as the mode is being changed to this class.

Subclasses should override this method to prepare the scene (such as enabling/disabling items in the scene, adding items to be drawn while the mode is active, etc.)

Reimplemented in smtk::extension::qtConnectMode, smtk::extension::qtSelectMode, smtk::extension::qtDisconnectMode, and smtk::extension::qtPanMode.

◆ exitMode()

virtual void smtk::extension::qtDiagramViewMode::exitMode ( )
inlineprotectedvirtual

This method is called by the diagram as the mode is being changed away from this class.

Subclasses should override this method to prepare the scene (such as enabling/disabling items in the scene, removing items drawn while the mode was active, etc.)

Reimplemented in smtk::extension::qtConnectMode, smtk::extension::qtSelectMode, smtk::extension::qtDisconnectMode, and smtk::extension::qtPanMode.

◆ sceneCleared()

virtual void smtk::extension::qtDiagramViewMode::sceneCleared ( qtDiagramGenerator = nullptr)
inlineprotectedvirtual

This method is called by diagram generators as the scene is cleared.

Subclasses which add items to the scene need to override this method to recreate their internal items.

Reimplemented in smtk::extension::qtConnectMode.

◆ updateFromOperation()

virtual void smtk::extension::qtDiagramViewMode::updateFromOperation ( std::unordered_set< smtk::resource::PersistentObject * > &  created,
std::unordered_set< smtk::resource::PersistentObject * > &  modified,
std::unordered_set< smtk::resource::PersistentObject * > &  expunged,
const smtk::operation::Operation operation,
const smtk::operation::Operation::Result result 
)
inlineprotectedvirtual

This method is called by the diagram when an operation is observed.

Subclasses may override this if they have state related to persistent objects in order to adapt to those objects being modified or expunged.

Reimplemented in smtk::extension::qtConnectMode.


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