Tulip  5.7.4
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 bool showContextMenu (const QPoint &, const QPointF &)
 
virtual void undoIsDone ()=0
 
virtual void uninstall ()=0
 

Public Member Functions

virtual QAction * action () const =0
 
std::string category () const override
 
virtual QLabel * configurationDocWidget () const
 
virtual QWidget * configurationOptionsWidget () const
 
virtual QWidget * configurationWidget () const
 
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
 

Static Public Member Functions

static void setupConfigWidget (QWidget *)
 

Protected Member Functions

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

Properties

QAction * action
 
QCursor cursor
 
unsigned int priority
 

Additional Inherited Members

- Protected Attributes inherited from tlp::Plugin
std::string oldName
 

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 62 of file Interactor.h.

Member Function Documentation

◆ action()

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.

◆ category()

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

A string identifier for a plugin used for categorization purposes.

Returns
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
inlinevirtual
Deprecated:
Use QWidget *configurationDocWidget() and/or QWidget *configurationOptionsWidget() instead
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 developer to delete the configuration widget

Definition at line 92 of file Interactor.h.

◆ 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
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.

◆ eventFilter()

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

Provides input filtering for the interactor.

See also
QObject::eventFilter()

Definition at line 184 of file Interactor.h.

◆ icon()

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

The icon (preferably a thumbnail) of the plugin.

Returns
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 that 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
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.

◆ setupConfigWidget()

static void tlp::Interactor::setupConfigWidget ( QWidget *  )
static

this method should be called before setting up the ui of an interactor config widget

◆ setView

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.

◆ showContextMenu

virtual bool tlp::Interactor::showContextMenu ( const QPoint &  ,
const QPointF &   
)
inlinevirtualslot

This method is called whenever the context menu is required on the view.

Parameters
pointThe screen coordinates where the context menu should be displayed.
Returns
true or false whether the context menu has been shown or not

Reimplemented in tlp::InteractorComposite.

Definition at line 155 of file Interactor.h.

◆ 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
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.