QElectroTech  0.70
Signals | Public Member Functions | Protected Attributes | List of all members
DiagramEventInterface Class Referenceabstract

The DiagramEventInterface class isRunning() return true if action is running (do something). By default return false. More...

#include <diagrameventinterface.h>

Signals

void finish ()
 

Public Member Functions

 DiagramEventInterface (Diagram *diagram)
 
 ~DiagramEventInterface () override=0
 
virtual void mouseDoubleClickEvent (QGraphicsSceneMouseEvent *event)
 
virtual void mousePressEvent (QGraphicsSceneMouseEvent *event)
 
virtual void mouseMoveEvent (QGraphicsSceneMouseEvent *event)
 
virtual void mouseReleaseEvent (QGraphicsSceneMouseEvent *event)
 
virtual void wheelEvent (QGraphicsSceneWheelEvent *event)
 
virtual void keyPressEvent (QKeyEvent *event)
 DiagramEventInterface::keyPressEvent By default, press escape key abort the curent action. More...
 
virtual void keyReleaseEvent (QKeyEvent *event)
 
virtual bool isRunning () const
 
virtual void init ()
 

Protected Attributes

Diagramm_diagram
 
bool m_running
 
bool m_abort
 

Detailed Description

The DiagramEventInterface class isRunning() return true if action is running (do something). By default return false.

USE DiagramEventInterface

This class is the basic interface for manage event on a diagram. To create a behavior for event diagram, we need to herite this class. This interface work like this : You need to create an interface and call diagram::setEventInterface(pointer_of_your_interface). When a diagram get an event (mouse or key) if they have an event interface, they send the event (with the status accepted to false) to the interface (for exemple mousePressEvent). If the interface do something with this event, you need to set to true the accepted status of the event, then diagram do nothing. When the interface job is done, we need to emit the signal finish(), the diagram use this signal to delete the interface. Be carreful with the destructor, diagram can at any time (even if interface is still running) delete the interface, the bool m_abort is here for that at destruction time.

Definition at line 45 of file diagrameventinterface.h.

Constructor & Destructor Documentation

◆ DiagramEventInterface()

DiagramEventInterface::DiagramEventInterface ( Diagram diagram)

Definition at line 24 of file diagrameventinterface.cpp.

References m_diagram.

◆ ~DiagramEventInterface()

DiagramEventInterface::~DiagramEventInterface ( )
overridepure virtual

Definition at line 32 of file diagrameventinterface.cpp.

Member Function Documentation

◆ finish

void DiagramEventInterface::finish ( )
signal

◆ init()

void DiagramEventInterface::init ( )
virtual

Reimplemented in DiagramEventAddElement, and DiagramEventAddShape.

Definition at line 78 of file diagrameventinterface.cpp.

◆ isRunning()

bool DiagramEventInterface::isRunning ( ) const
virtual

Definition at line 74 of file diagrameventinterface.cpp.

References m_running.

◆ keyPressEvent()

void DiagramEventInterface::keyPressEvent ( QKeyEvent *  event)
virtual

DiagramEventInterface::keyPressEvent By default, press escape key abort the curent action.

Parameters
event

Reimplemented in DiagramEventAddElement.

Definition at line 59 of file diagrameventinterface.cpp.

References finish(), m_abort, and m_running.

Referenced by DiagramEventAddElement::keyPressEvent(), and Diagram::keyPressEvent().

◆ keyReleaseEvent()

void DiagramEventInterface::keyReleaseEvent ( QKeyEvent *  event)
virtual

Definition at line 70 of file diagrameventinterface.cpp.

Referenced by Diagram::keyReleaseEvent().

◆ mouseDoubleClickEvent()

void DiagramEventInterface::mouseDoubleClickEvent ( QGraphicsSceneMouseEvent *  event)
virtual

◆ mouseMoveEvent()

void DiagramEventInterface::mouseMoveEvent ( QGraphicsSceneMouseEvent *  event)
virtual

◆ mousePressEvent()

void DiagramEventInterface::mousePressEvent ( QGraphicsSceneMouseEvent *  event)
virtual

◆ mouseReleaseEvent()

void DiagramEventInterface::mouseReleaseEvent ( QGraphicsSceneMouseEvent *  event)
virtual

Reimplemented in DiagramEventAddElement, and DiagramEventAddShape.

Definition at line 46 of file diagrameventinterface.cpp.

Referenced by Diagram::mouseReleaseEvent().

◆ wheelEvent()

void DiagramEventInterface::wheelEvent ( QGraphicsSceneWheelEvent *  event)
virtual

Reimplemented in DiagramEventAddImage.

Definition at line 50 of file diagrameventinterface.cpp.

Referenced by Diagram::wheelEvent().

Member Data Documentation

◆ m_abort

bool DiagramEventInterface::m_abort
protected

◆ m_diagram

Diagram* DiagramEventInterface::m_diagram
protected

◆ m_running

bool DiagramEventInterface::m_running
protected

The documentation for this class was generated from the following files: