feat: cleanup event passing

This commit is contained in:
parker
2025-06-23 16:02:27 +01:00
parent 9bddf401f4
commit 73a0529e30
4 changed files with 28 additions and 19 deletions

View File

@@ -54,10 +54,6 @@ void NetworkGraphicsView::mouseReleaseEvent(QMouseEvent *event) {
void NetworkGraphicsView::mousePressEvent(QMouseEvent *event)
{
if( event->buttons() & Qt::LeftButton)
{
leftMousePress(event);
}
if(
event->button() == Qt::MiddleButton
)
@@ -67,22 +63,26 @@ void NetworkGraphicsView::mousePressEvent(QMouseEvent *event)
return;
}
// pass event to parent
QGraphicsView::mouseReleaseEvent(event);
if (parentWidget()) {
QMouseEvent *eventCopy = new QMouseEvent(
event->type(),
event->position(),
event->scenePosition(),
event->globalPosition(),
event->button(),
event->buttons(),
event->modifiers()
);
QCoreApplication::postEvent(parentWidget(), eventCopy);
}
QGraphicsView::mousePressEvent(event);
}
void NetworkGraphicsView::leftMousePress(QMouseEvent *event)
{
network_->leftMousePress(event);
// QGraphicsItem* itemClicked = itemAt(event->pos());
// bool isSocket = itemClicked && typeid(*itemClicked)==typeid(SocketGraphic);
// if(isSocket)
// {
// std::cout << "SOCKET!\n";
// network_->socketClicked(static_cast<SocketGraphic*>(itemClicked), event);
// }
}
// void NetworkView::mouseReleaseEvent(QMouseEvent *event)
// {