feat: delete floating edge with esc
This commit is contained in:
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ private:
|
|||||||
NetworkGraphicsScene* scene_;
|
NetworkGraphicsScene* scene_;
|
||||||
NetworkGraphicsView* view_;
|
NetworkGraphicsView* view_;
|
||||||
FloatingEdgeGraphic* floatingEdge_=nullptr;
|
FloatingEdgeGraphic* floatingEdge_=nullptr;
|
||||||
|
void keyPressEvent(QKeyEvent *event) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user