feat: delete floating edge with esc

This commit is contained in:
parker
2025-06-21 01:18:08 +01:00
parent e1b88b5fdc
commit 1cfcb0e429
2 changed files with 15 additions and 1 deletions

View File

@@ -74,3 +74,17 @@ void Network::mouseMoved(QMouseEvent *event)
}
}
void Network::keyPressEvent(QKeyEvent *event)
{
if(event->key() == Qt::Key_Escape)
{
// delete floating edge
if(floatingEdge_)
{
scene_->removeItem(floatingEdge_);
delete floatingEdge_;
floatingEdge_=nullptr;
}
}
}

View File

@@ -17,7 +17,7 @@ private:
NetworkGraphicsScene* scene_;
NetworkGraphicsView* view_;
FloatingEdgeGraphic* floatingEdge_=nullptr;
void keyPressEvent(QKeyEvent *event) override;
protected:
};