2015-03-04 21:13:13 +00:00
|
|
|
/*
|
2025-01-04 13:37:40 +01:00
|
|
|
Copyright 2006-2025 The QElectroTech Team
|
2015-03-04 21:13:13 +00:00
|
|
|
This file is part of QElectroTech.
|
|
|
|
|
|
|
|
QElectroTech is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
QElectroTech is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
#include "diagrameventinterface.h"
|
2020-12-08 19:57:35 +01:00
|
|
|
|
|
|
|
#include "../diagram.h"
|
|
|
|
|
2015-03-04 21:13:13 +00:00
|
|
|
#include <QGraphicsSceneMouseEvent>
|
|
|
|
#include <QKeyEvent>
|
|
|
|
|
|
|
|
DiagramEventInterface::DiagramEventInterface(Diagram *diagram) :
|
2024-04-24 14:14:40 +02:00
|
|
|
QObject{diagram},
|
|
|
|
m_diagram{diagram}
|
2015-03-04 21:13:13 +00:00
|
|
|
{
|
2015-03-20 11:58:22 +00:00
|
|
|
m_diagram -> clearSelection();
|
2015-03-04 21:13:13 +00:00
|
|
|
}
|
|
|
|
|
2020-09-07 22:03:40 +02:00
|
|
|
DiagramEventInterface::~DiagramEventInterface()
|
2022-11-14 22:42:27 +01:00
|
|
|
{}
|
2015-03-04 21:13:13 +00:00
|
|
|
|
2019-01-14 18:25:43 +00:00
|
|
|
void DiagramEventInterface::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) {
|
2015-03-04 21:13:13 +00:00
|
|
|
Q_UNUSED (event);
|
|
|
|
}
|
|
|
|
|
2019-01-14 18:25:43 +00:00
|
|
|
void DiagramEventInterface::mousePressEvent(QGraphicsSceneMouseEvent *event) {
|
2015-03-04 21:13:13 +00:00
|
|
|
Q_UNUSED (event);
|
|
|
|
}
|
|
|
|
|
2019-01-14 18:25:43 +00:00
|
|
|
void DiagramEventInterface::mouseMoveEvent(QGraphicsSceneMouseEvent *event) {
|
2015-03-04 21:13:13 +00:00
|
|
|
Q_UNUSED (event);
|
|
|
|
}
|
|
|
|
|
2019-01-14 18:25:43 +00:00
|
|
|
void DiagramEventInterface::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) {
|
2015-03-04 21:13:13 +00:00
|
|
|
Q_UNUSED (event);
|
|
|
|
}
|
|
|
|
|
2019-01-14 18:25:43 +00:00
|
|
|
void DiagramEventInterface::wheelEvent(QGraphicsSceneWheelEvent *event) {
|
2015-03-04 21:13:13 +00:00
|
|
|
Q_UNUSED (event);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-08-16 11:19:36 +02:00
|
|
|
@brief DiagramEventInterface::keyPressEvent
|
2022-12-04 08:21:12 -05:00
|
|
|
By default, press escape key abort the current action
|
2020-08-16 11:19:36 +02:00
|
|
|
@param event
|
|
|
|
*/
|
2019-01-14 18:25:43 +00:00
|
|
|
void DiagramEventInterface::keyPressEvent(QKeyEvent *event)
|
|
|
|
{
|
|
|
|
if (event->key() == Qt::Key_Escape)
|
|
|
|
{
|
2015-03-04 21:13:13 +00:00
|
|
|
m_running = false;
|
|
|
|
m_abort = true;
|
2015-11-07 12:28:43 +00:00
|
|
|
emit finish();
|
2019-01-14 18:25:43 +00:00
|
|
|
event->setAccepted(true);
|
2015-03-04 21:13:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-14 18:25:43 +00:00
|
|
|
void DiagramEventInterface::keyReleaseEvent(QKeyEvent *event){
|
2015-03-04 21:13:13 +00:00
|
|
|
Q_UNUSED (event);
|
|
|
|
}
|
|
|
|
|
2020-09-07 22:03:40 +02:00
|
|
|
bool DiagramEventInterface::isRunning() const
|
|
|
|
{
|
2015-03-04 21:13:13 +00:00
|
|
|
return m_running;
|
|
|
|
}
|
|
|
|
|
|
|
|
void DiagramEventInterface::init()
|
|
|
|
{}
|