mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-02-20 19:19:58 +01:00
Minor change
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4255 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -95,7 +95,7 @@ bool DiagramEventAddElement::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||
|
||||
/**
|
||||
* @brief DiagramEventAddElement::mouseReleaseEvent
|
||||
* Right button finish this event (isRunning = false)
|
||||
* Right button finish this event (isRunning = false) and emit finish.
|
||||
* Left button add an element to diagram
|
||||
* @param event
|
||||
* @return always true
|
||||
@@ -109,6 +109,7 @@ bool DiagramEventAddElement::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||
delete m_element;
|
||||
m_element = nullptr;
|
||||
m_running = false;
|
||||
emit finish();
|
||||
}
|
||||
else if (event->button() == Qt::LeftButton)
|
||||
{
|
||||
@@ -121,7 +122,7 @@ bool DiagramEventAddElement::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||
|
||||
/**
|
||||
* @brief DiagramEventAddElement::mouseDoubleClickEvent
|
||||
* If mouse left double clic, finish this event (isRunning = false)
|
||||
* If mouse left double clic, finish this event (isRunning = false) and emit finish
|
||||
* @param event
|
||||
* @return always true
|
||||
*/
|
||||
@@ -132,6 +133,7 @@ bool DiagramEventAddElement::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *eve
|
||||
delete m_element;
|
||||
m_element = nullptr;
|
||||
m_running = false;
|
||||
emit finish();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -81,9 +81,5 @@ bool DiagramEventInterface::isRunning() const {
|
||||
return m_running;
|
||||
}
|
||||
|
||||
bool DiagramEventInterface::isFinish() const {
|
||||
return !m_running;
|
||||
}
|
||||
|
||||
void DiagramEventInterface::init()
|
||||
{}
|
||||
|
||||
@@ -29,8 +29,7 @@ class Diagram;
|
||||
* @brief The DiagramEventInterface class
|
||||
* Each method return a bool: True if the methode do something else return false.
|
||||
* Each method of DVEventInterface return false;
|
||||
* isRunning() return true if action is started but not finish. By default return false.
|
||||
* isFinish() return true when the action is finish, or not started. By default return true.
|
||||
* 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.
|
||||
@@ -41,8 +40,7 @@ class Diagram;
|
||||
* they send the event to the interface (for exemple mousePressEvent).
|
||||
* If the interface do something with this event, you need to return true to signal the diagram you work with this event.
|
||||
* (if you do nothing by defaut the interface return false, so diagram do nothing)
|
||||
* after that, the diagram call interface::isRunning(), if true diagram do nothing, else if false,
|
||||
* that mean interface has finish is action (interface::isFinish return true) so the diagram will delete this interface.
|
||||
* 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.
|
||||
*
|
||||
@@ -62,7 +60,6 @@ class DiagramEventInterface : public QObject
|
||||
virtual bool keyPressEvent (QKeyEvent *event);
|
||||
virtual bool KeyReleaseEvent (QKeyEvent *event);
|
||||
virtual bool isRunning () const;
|
||||
virtual bool isFinish () const;
|
||||
virtual void init();
|
||||
|
||||
signals:
|
||||
|
||||
Reference in New Issue
Block a user