Tulip  5.1.0
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
 
virtual std::string category () const
 
virtual QWidget * configurationWidget () const =0
 
virtual void construct ()=0
 
virtual QCursor cursor () const =0
 
std::string icon () const
 
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
 
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

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

Properties

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

Additional Inherited Members

- 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
QObject::eventFilter()

Definition at line 53 of file Interactor.h.

Member Function Documentation

virtual QAction* tlp::Interactor::action ( ) const
pure virtual
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.

Implemented in tlp::InteractorComposite.

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

A string identifier for a plugin used for categorization purposes.

Returns
std::string the category of the plugin.

Implements tlp::Plugin.

Definition at line 61 of file Interactor.h.

virtual QWidget* tlp::Interactor::configurationWidget ( ) const
pure virtual
Returns
the configuration widget used to set up the interactor.
Warning
This method MUST ALWAYS return the same pointer. Doing otherwise may lead to memory leaks.
Note
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.

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.

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

Implemented in tlp::InteractorComposite.

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

Provides input filtering for the interactor.

See also
QObject::eventFilter()

Definition at line 143 of file Interactor.h.

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

The icon (preferably a thumbnail) of the plugin.

Returns
std::string the icon path

Reimplemented from tlp::Plugin.

Definition at line 64 of file Interactor.h.

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.

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.

virtual unsigned int tlp::Interactor::priority ( ) const
pure virtual
Returns
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.

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

Defines the view object associated to this interactor.

Warning
The view() method MUST ALWAYS return the same pointer as the one passed down to this method.
virtual void tlp::Interactor::undoIsDone ( )
pure virtualslot

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

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.

virtual tlp::View* tlp::Interactor::view ( ) const
pure virtual
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.

Implemented in tlp::InteractorComposite.