Tulip  5.2.1
Large graphs analysis and drawing
tlp::Interactor Class Referenceabstract

#include <Interactor.h>

+ Inheritance diagram for tlp::Interactor:
+ Collaboration diagram for tlp::Interactor:

Public Slots

virtual void install (QObject *target)=0
virtual void setView (tlp::View *)=0
virtual void undoIsDone ()=0
virtual void uninstall ()=0

Public Member Functions

virtual QAction * action () const =0
std::string category () const override
virtual QWidget * configurationWidget () const =0
virtual void construct ()=0
virtual QCursor cursor () const =0
std::string icon () const override
virtual bool isCompatible (const std::string &viewName) const =0
virtual unsigned int priority () const =0
virtual tlp::Viewview () 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
- Public Member Functions inherited from tlp::WithParameter
template<typename T >
void addInOutParameter (const std::string &name, const std::string &help=std::string(), const std::string &defaultValue=std::string(), bool isMandatory=true, const std::string &valuesDescription=std::string())
template<typename T >
void addInParameter (const std::string &name, const std::string &help, const std::string &defaultValue, bool isMandatory=true, const std::string &valuesDescription=std::string())
template<typename T >
void addOutParameter (const std::string &name, const std::string &help=std::string(), const std::string &defaultValue=std::string(), bool isMandatory=true, const std::string &valuesDescription=std::string())
template<typename T >
void addParameter (const std::string &name, const std::string &help=std::string(), const std::string &defaultValue=std::string(), bool isMandatory=true)
const tlp::ParameterDescriptionListgetParameters () const
bool inputRequired () const
- Public Member Functions inherited from tlp::WithDependency
void addDependency (const char *name, const char *release)
const std::list< Dependency > & dependencies () const

Protected Member Functions

bool eventFilter (QObject *obj, QEvent *ev) override


QAction action
QCursor cursor
unsigned int priority
tlp::View view

Additional Inherited Members

- Protected Attributes inherited from tlp::Plugin
std::string oldName
- Protected Attributes inherited from tlp::WithDependency
std::list< Dependency_dependencies

Detailed Description

Interactor provides a way to handle user inputs over a view. Basically, The interactor class is an overlay to the Qt's event filtering mechanism. It adds several features like the ability to define priorities, custom cursors, etc.

When an interactor is constructed, the following methods are called in this order:

  • The constructor. This method should almost be a no-op. Interactors may be instantiated by the plugin manager system and doing unneeded operations in the constructor may lead to poor performances when the application loads up.
  • isCompatible. When creating a View, the application will check for all interactors to see if they could be installed on it. This is done using the isCompatible method.
  • construct. Initialize the interactor. Since the constructor should be a no-op, initialization code should be put here.
  • setView. Defines the view this interactor is bound to. The Interactor may keep a reference to the view object to perform specific operations on user inputs.

Methods listed above are only called once. Once the interactor is initialized, it may be installed/removed several times on different QObjects. It will then repond to user inputs via the eventFilter method

See also

Definition at line 61 of file Interactor.h.

Member Function Documentation

◆ action()

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

Implemented in tlp::InteractorComposite.

◆ category()

std::string tlp::Interactor::category ( ) const

A string identifier for a plugin used for categorization purposes.

std::string the category of the plugin.

Implements tlp::Plugin.

Definition at line 69 of file Interactor.h.

◆ configurationWidget()

virtual QWidget* tlp::Interactor::configurationWidget ( ) const
pure virtual
the configuration widget used to set up the interactor.
This method MUST ALWAYS return the same pointer. Doing otherwise may lead to memory leaks.
The configuration widget has to be instantiated from the construct method.
It is up to the interactor developper to delete the configuration widget

Implemented in tlp::NodeLinkDiagramComponentInteractor.

◆ construct()

virtual void tlp::Interactor::construct ( )
pure virtual

Builds up the interactor's internal state. This method should be used instead of the constructor to initialize the interactor.

◆ cursor()

virtual QCursor tlp::Interactor::cursor ( ) const
pure virtual
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.

Implemented in tlp::InteractorComposite.

◆ eventFilter()

bool tlp::Interactor::eventFilter ( QObject *  obj,
QEvent *  ev 

Provides input filtering for the interactor.

See also

Definition at line 159 of file Interactor.h.

◆ icon()

std::string tlp::Interactor::icon ( ) const

The icon (preferably a thumbnail) of the plugin.

std::string the icon path

Reimplemented from tlp::Plugin.

Definition at line 72 of file Interactor.h.

◆ install

virtual void tlp::Interactor::install ( QObject *  target)
pure virtualslot

Install the interactor on the given target A call to this method means thatr the interactor should start listening to the target's events and handle them. Returning true prevents further handling of the event. Doing otherwise means that the interactor will let following filters to hand over this kind of event.

◆ isCompatible()

virtual bool tlp::Interactor::isCompatible ( const std::string &  viewName) const
pure virtual

Checks the compatibility between the interactor and the given view (identified by its name). If this method returns true, it's very likely that the interactor will be installed on the associated view.

◆ priority()

virtual unsigned int tlp::Interactor::priority ( ) const
pure virtual
the interactor's priority. Priority defines how interactors gets ordered when displayed in the View's toolbar. Interactors with the top-most priority value will be displayed at the beginning of the list while lowest priority will be position at the end.

Implemented in tlp::NodeLinkDiagramComponentInteractor.

◆ setView

virtual void tlp::Interactor::setView ( tlp::View )
pure virtualslot

Defines the view object associated to this interactor.

The view() method MUST ALWAYS return the same pointer as the one passed down to this method.

◆ undoIsDone

virtual void tlp::Interactor::undoIsDone ( )
pure virtualslot

Informs the interactor when the undo command (Ctrl+Z) has been triggered.

◆ uninstall

virtual void tlp::Interactor::uninstall ( )
pure virtualslot

Removes the interactor from the previously set target. Interactors can be installed on only one target at once.

◆ view()

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

Implemented in tlp::InteractorComposite.