Tulip
4.6.0
Better Visualization Through Research
|
Public Types | |
typedef QList < InteractorComponent * > ::const_iterator | const_iterator |
typedef QList < InteractorComponent * > ::iterator | iterator |
Public Slots | |
virtual void | install (QObject *target) |
virtual void | setView (tlp::View *view) |
virtual void | undoIsDone () |
virtual void | uninstall () |
Public Member Functions | |
InteractorComposite (const QIcon &icon, const QString &text="") | |
virtual QAction * | action () const |
iterator | begin () |
const_iterator | begin () const |
virtual QCursor | cursor () const |
iterator | end () |
const_iterator | end () const |
void | push_back (InteractorComponent *component) |
void | push_front (InteractorComponent *component) |
virtual tlp::View * | view () const |
Protected Slots | |
void | lastTargetDestroyed () |
Protected Member Functions | |
QObject * | lastTarget () const |
void | setLastTarget (QObject *) |
Protected Attributes | |
QList< tlp::InteractorComponent * > | _components |
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 87 of file InteractorComposite.h.
tlp::InteractorComposite::InteractorComposite | ( | const QIcon & | icon, |
const QString & | text = "" |
||
) |
Default constructor.
icon | The icon set on the interactor's action |
text | The text set on the interactor's action |
virtual QAction* tlp::InteractorComposite::action | ( | ) | const [virtual] |
Implements tlp::Interactor.
iterator tlp::InteractorComposite::begin | ( | ) |
Since InteractorComposte behaves like a list of InteractorComponent, this method is here to allow this class to be iterable.
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.
virtual QCursor tlp::InteractorComposite::cursor | ( | ) | const [virtual] |
Implements tlp::Interactor.
iterator tlp::InteractorComposite::end | ( | ) |
Since InteractorComposte behaves like a list of InteractorComponent, this method is here to allow this class to be iterable.
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.
virtual void tlp::InteractorComposite::install | ( | QObject * | target | ) | [virtual, slot] |
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.
Implements tlp::Interactor.
QObject* tlp::InteractorComposite::lastTarget | ( | ) | const [protected] |
void tlp::InteractorComposite::push_back | ( | InteractorComponent * | component | ) |
Pushs an InteractorComponent at the end of the list.
void tlp::InteractorComposite::push_front | ( | InteractorComponent * | component | ) |
Pushs an InteractorComponent at the beggining of the list.
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.
virtual void tlp::InteractorComposite::setView | ( | tlp::View * | ) | [virtual, slot] |
Defines the view object associated to this interactor.
Implements tlp::Interactor.
virtual void tlp::InteractorComposite::undoIsDone | ( | ) | [virtual, slot] |
Informs the interactor when the undo command (Ctrl+Z) has been triggered.
Implements tlp::Interactor.
virtual void tlp::InteractorComposite::uninstall | ( | ) | [virtual, slot] |
Removes the interactor from the previously set target. Interactors can be installed on only one target at once.
Implements tlp::Interactor.
virtual tlp::View* tlp::InteractorComposite::view | ( | ) | const [virtual] |
Implements tlp::Interactor.