QElectroTech 0.100.0-dev
Loading...
Searching...
No Matches
diagrameventinterface.h
Go to the documentation of this file.
1/*
2 Copyright 2006-2024 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#ifndef DIAGRAMEVENTINTERFACE_H
19#define DIAGRAMEVENTINTERFACE_H
20
21#include <QObject>
22#include <QPointer>
23
24class QGraphicsSceneMouseEvent;
25class QGraphicsSceneWheelEvent;
26class QKeyEvent;
27class Diagram;
28
46class DiagramEventInterface : public QObject
47{
48 Q_OBJECT
49
50 public:
52 ~DiagramEventInterface() override = 0;
53 virtual void mouseDoubleClickEvent (QGraphicsSceneMouseEvent *event);
54 virtual void mousePressEvent (QGraphicsSceneMouseEvent *event);
55 virtual void mouseMoveEvent (QGraphicsSceneMouseEvent *event);
56 virtual void mouseReleaseEvent (QGraphicsSceneMouseEvent *event);
57 virtual void wheelEvent (QGraphicsSceneWheelEvent *event);
58 virtual void keyPressEvent (QKeyEvent *event);
59 virtual void keyReleaseEvent (QKeyEvent *event);
60 virtual bool isRunning () const;
61 virtual void init();
62
63 signals:
64 void finish(); //Emitted when the interface finishes its job.
65
66 protected:
67 QPointer<Diagram> m_diagram;
68 bool m_running{false};
69 bool m_abort{false};
70};
71
72#endif // DIAGRAMEVENTINTERFACE_H
The DiagramEventInterface class isRunning() return true if action is running (do something)....
Definition diagrameventinterface.h:47
virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
Definition diagrameventinterface.cpp:35
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
Definition diagrameventinterface.cpp:47
virtual bool isRunning() const
Definition diagrameventinterface.cpp:75
virtual void init()
Definition diagrameventinterface.cpp:80
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event)
Definition diagrameventinterface.cpp:39
QPointer< Diagram > m_diagram
Definition diagrameventinterface.h:67
bool m_running
Definition diagrameventinterface.h:68
~DiagramEventInterface() override=0
Definition diagrameventinterface.cpp:32
bool m_abort
Definition diagrameventinterface.h:69
virtual void keyReleaseEvent(QKeyEvent *event)
Definition diagrameventinterface.cpp:71
virtual void keyPressEvent(QKeyEvent *event)
DiagramEventInterface::keyPressEvent By default, press escape key abort the current action.
Definition diagrameventinterface.cpp:60
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event)
Definition diagrameventinterface.cpp:43
virtual void wheelEvent(QGraphicsSceneWheelEvent *event)
Definition diagrameventinterface.cpp:51
The Diagram class This class represents an electric diagram. It manages its various child elements,...
Definition diagram.h:56