QElectroTech  0.70
diagrameventinterface.cpp
Go to the documentation of this file.
1 /*
2  Copyright 2006-2019 The QElectroTech Team
3  This file is part of QElectroTech.
4 
5  QElectroTech is free software: you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation, either version 2 of the License, or
8  (at your option) any later version.
9 
10  QElectroTech is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
17 */
18 #include "diagrameventinterface.h"
19 #include "diagram.h"
20 #include <QGraphicsSceneMouseEvent>
21 #include <QKeyEvent>
22 
23 
25  m_diagram(diagram),
26  m_running(false),
27  m_abort(false)
28 {
29  m_diagram -> clearSelection();
30 }
31 
33 
34 void DiagramEventInterface::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) {
35  Q_UNUSED (event);
36 }
37 
38 void DiagramEventInterface::mousePressEvent(QGraphicsSceneMouseEvent *event) {
39  Q_UNUSED (event);
40 }
41 
42 void DiagramEventInterface::mouseMoveEvent(QGraphicsSceneMouseEvent *event) {
43  Q_UNUSED (event);
44 }
45 
46 void DiagramEventInterface::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) {
47  Q_UNUSED (event);
48 }
49 
50 void DiagramEventInterface::wheelEvent(QGraphicsSceneWheelEvent *event) {
51  Q_UNUSED (event);
52 }
53 
60 {
61  if (event->key() == Qt::Key_Escape)
62  {
63  m_running = false;
64  m_abort = true;
65  emit finish();
66  event->setAccepted(true);
67  }
68 }
69 
71  Q_UNUSED (event);
72 }
73 
75  return m_running;
76 }
77 
79 {}
virtual void keyPressEvent(QKeyEvent *event)
DiagramEventInterface::keyPressEvent By default, press escape key abort the curent action...
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event)
virtual bool isRunning() const
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event)
DiagramEventInterface(Diagram *diagram)
virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
virtual void keyReleaseEvent(QKeyEvent *event)
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
virtual void wheelEvent(QGraphicsSceneWheelEvent *event)