From 15979109133dc978f122dba7eea47e08bb229bba Mon Sep 17 00:00:00 2001 From: toni Date: Fri, 13 Dec 2019 19:10:14 +0100 Subject: [PATCH] deleting windows is now possible --- mapview/2D/MV2DElementFloorObstacleWall.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/mapview/2D/MV2DElementFloorObstacleWall.cpp b/mapview/2D/MV2DElementFloorObstacleWall.cpp index 6c4706e..8497129 100644 --- a/mapview/2D/MV2DElementFloorObstacleWall.cpp +++ b/mapview/2D/MV2DElementFloorObstacleWall.cpp @@ -338,9 +338,19 @@ bool MV2DElementFloorObstacleWall::keyPressEvent(MapView2D* v, QKeyEvent* e) { fo->windows.push_back(win); return true; } else if (e->key() == Qt::Key_Delete && getSelectedNode() >= 1000) { - const int idx = getSelectedNode() - 1000; - fo->doors.erase(fo->doors.begin()+idx); - return true; + + int userIdx = getSelectedNode(); + + if (userIdx >= 1000 && userIdx < 2000) { + const int idx = getSelectedNode() - 1000; + fo->doors.erase(fo->doors.begin()+idx); + return true; + } else if (userIdx >= 2000 && userIdx < 3000) { + const int idx = getSelectedNode() - 2000; + fo->windows.erase(fo->windows.begin()+idx); + return true; + } + } return false;