Tulip  5.7.4
Large graphs analysis and drawing
tlp::InteractorComposite Class Reference
+ Inheritance diagram for tlp::InteractorComposite:
+ Collaboration diagram for tlp::InteractorComposite:

Public Types

typedef QList< InteractorComponent * >::const_iterator const_iterator
 
typedef QList< InteractorComponent * >::iterator iterator
 

Public Slots

void install (QObject *target) override
 
void setView (tlp::View *view) override
 
void undoIsDone () override
 
void uninstall () override
 
- Public Slots inherited from tlp::Interactor
virtual void install (QObject *target)=0
 
virtual void setView (tlp::View *)=0
 
virtual void undoIsDone ()=0
 
virtual void uninstall ()=0
 

Public Member Functions

 InteractorComposite (const QIcon &icon, const QString &text="")
 
QAction * action () const override
 
iterator begin ()
 
const_iterator begin () const
 
QCursor cursor () const override
 
iterator end ()
 
const_iterator end () const
 
void push_back (InteractorComponent *component)
 
void push_front (InteractorComponent *component)
 
bool showContextMenu (const QPoint &, const QPointF &) override
 
tlp::Viewview () const override
 
- Public Member Functions inherited from tlp::Interactor
std::string category () const override
 
virtual QLabel * configurationDocWidget () const
 
virtual QWidget * configurationOptionsWidget () const
 
virtual QWidget * configurationWidget () const
 
virtual void construct ()=0
 
std::string icon () const override
 
virtual bool isCompatible (const std::string &viewName) const =0
 
virtual unsigned int priority () const =0
 
- Public Member Functions inherited from tlp::Plugin
virtual std::string author () const =0
 
virtual std::string date () const =0
 
void declareDeprecatedName (const std::string &oldName)
 
std::string deprecatedName ()
 
virtual std::string group () const =0
 
virtual int id () const
 
virtual std::string info () const =0
 
virtual std::string major () const
 
virtual std::string minor () const
 
virtual std::string name () const =0
 
virtual std::string programmingLanguage () const
 
virtual std::string release () const =0
 
virtual std::string tulipMajor () const
 
virtual std::string tulipMinor () const
 
virtual std::string tulipRelease () const =0
 

Protected Slots

void lastTargetDestroyed ()
 

Protected Member Functions

QObject * lastTarget () const
 
void setLastTarget (QObject *)
 
- Protected Member Functions inherited from tlp::Interactor
bool eventFilter (QObject *obj, QEvent *ev) override
 

Protected Attributes

QList< tlp::InteractorComponent * > _components
 
- Protected Attributes inherited from tlp::Plugin
std::string oldName
 

Additional Inherited Members

- Static Public Member Functions inherited from tlp::Interactor
static void setupConfigWidget (QWidget *)
 
- Properties inherited from tlp::Interactor
QAction * action
 
QCursor cursor
 
unsigned int priority
 

Detailed Description

event handler stored inside an InteractorComposite

This is meant to be focused on event handling only. An InteractorComponent should respond to user inputs in its eventFilter method and return true to avoid further propagation of the event to other components. This system is inherited from Qt event handling, see QObject::eventFilter() for details.

subclass of Interactor that allows building Interactors using component classes focused specifically on input handling.

The composite behaves like a regular interactor. Event handling is made using InteractorComponent subclasses. Basically, an InteractorComposite is a list of InteractorComponent. Each of them are meant to be pushed in the list using the push_back and push_front methods. When an event is caught by the InteractorComposite, it will iterate over all components (in th order provided by the list) and run eventFilter on each one of them until one of the component returns true.

When subclassing InteractorComposite, you should push your components in the construct() method (take care of the order they are pushed in). Once the setView() method is called (after construct()), the init() method will be run on every components.

Definition at line 106 of file InteractorComposite.h.

Constructor & Destructor Documentation

◆ InteractorComposite()

tlp::InteractorComposite::InteractorComposite ( const QIcon &  icon,
const QString &  text = "" 
)

Default constructor.

Parameters
iconThe icon set on the interactor's action
textThe text set on the interactor's action

Member Function Documentation

◆ action()

QAction* tlp::InteractorComposite::action ( ) const
overridevirtual
Returns
a QAction associated to this interactor. This is used by the overleying system to associate an icon/text to the interactor.
Warning
The parent (QObject::parent()) object of this QAction MUST BE the Interactor.

Implements tlp::Interactor.

◆ begin() [1/2]

iterator tlp::InteractorComposite::begin ( )

Since InteractorComposte behaves like a list of InteractorComponent, this method is here to allow this class to be iterable.

◆ begin() [2/2]

const_iterator tlp::InteractorComposite::begin ( ) const

Since InteractorComposte behaves like a list of InteractorComponent, this method is here to allow this class to be iterable.

◆ cursor()

QCursor tlp::InteractorComposite::cursor ( ) const
overridevirtual
Returns
The cursor associated to this interactor. When the interactor gets active on a view, the View's cursor is changed to what this method returns.

Implements tlp::Interactor.

◆ end() [1/2]

iterator tlp::InteractorComposite::end ( )

Since InteractorComposte behaves like a list of InteractorComponent, this method is here to allow this class to be iterable.

◆ end() [2/2]

const_iterator tlp::InteractorComposite::end ( ) const

Since InteractorComposte behaves like a list of InteractorComponent, this method is here to allow this class to be iterable.

◆ lastTarget()

QObject* tlp::InteractorComposite::lastTarget ( ) const
protected
Returns
The last target the interactor was installed on.
Note
If the lastTarget is destroyed before uninstall was called, the lastTarget() method will return nullptr.

◆ push_back()

void tlp::InteractorComposite::push_back ( InteractorComponent *  component)

Pushs an InteractorComponent at the end of the list.

◆ push_front()

void tlp::InteractorComposite::push_front ( InteractorComponent *  component)

Push an InteractorComponent at the beginning of the list.

◆ setLastTarget()

void tlp::InteractorComposite::setLastTarget ( QObject *  )
protected

backup a QObject into the InteractorComposite. This can be used to store the last target the interactor was installed on. This can be used when uninstall is called.

◆ showContextMenu()

bool tlp::InteractorComposite::showContextMenu ( const QPoint &  ,
const QPointF &   
)
overridevirtual

iterate on _components to show context menu

Reimplemented from tlp::Interactor.

◆ view()

tlp::View* tlp::InteractorComposite::view ( ) const
overridevirtual
Returns
the View object associated to this Interactor.
Warning
The returned object MUST be the same as the one passed down to the setView method.

Implements tlp::Interactor.