2017-12-26 22:18:37 +01:00
|
|
|
#include "mygraphicsscene.h"
|
|
|
|
#include <QDebug>
|
|
|
|
|
|
|
|
MyGraphicsScene::MyGraphicsScene()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2017-12-27 13:08:36 +01:00
|
|
|
MyGraphicsScene::~MyGraphicsScene()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2018-11-27 00:26:41 +01:00
|
|
|
void MyGraphicsScene::mousePressEvent(QGraphicsSceneMouseEvent* const mouseEvent)
|
2017-12-26 22:18:37 +01:00
|
|
|
{
|
2018-11-27 00:26:41 +01:00
|
|
|
const QGraphicsItem* const it = itemAt(mouseEvent->scenePos(), QTransform());
|
2017-12-26 22:18:37 +01:00
|
|
|
|
2018-11-25 18:02:18 +01:00
|
|
|
if (it != nullptr)
|
2018-11-27 00:26:41 +01:00
|
|
|
{
|
2017-12-27 13:08:36 +01:00
|
|
|
emit positionClicked(mouseEvent->scenePos());
|
2017-12-26 22:18:37 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// No items selected
|
2017-12-27 13:08:36 +01:00
|
|
|
emit noItemSelected();
|
2017-12-26 22:18:37 +01:00
|
|
|
}
|
|
|
|
}
|
2017-12-27 13:08:36 +01:00
|
|
|
|
2018-11-27 00:26:41 +01:00
|
|
|
void MyGraphicsScene::mouseDoubleClickEvent(QGraphicsSceneMouseEvent* const mouseEvent)
|
2017-12-27 13:08:36 +01:00
|
|
|
{
|
2018-11-27 00:26:41 +01:00
|
|
|
emit updateSelectedItem(mouseEvent->button());
|
2017-12-27 13:08:36 +01:00
|
|
|
}
|