delete the selected edge?

I am trying to select the edge and delete the selected edge. How can i delete the selected entity like edge/arc. below code does not work properly....

void View::onLButtonDown( const int/*Qt::MouseButtons*/ nFlags, const QPoint point )

{

myContext->ActivateStandardMode(TopAbs_EDGE );

//myContext->Select();

//myContext->OpenLocalContext();

myContext->InitSelected();

while(myContext->MoreSelected())//myContext->MoreCurrent())

{

Standard_Boolean flag = myContext->HasSelectedShape();

if(flag)

{

TopoDS_Shape selectedEdge = myContext->SelectedShape();

if( selectedEdge.ShapeType() == TopAbs_EDGE)

{

o_edge = TopoDS ::Edge (selectedEdge);

//myContext->Erase( myContext->Current(), false, false );

myContext->EraseSelected(false,false);

}

}

else

{

TopoDS_Shape vertex = Handle(AIS_Shape)::DownCast( myContext->SelectedInteractive() )->Shape();

}

//myContext->NextSelected();

}

ATTIA's picture