Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Simplify method keyPressEvent.
[graphlib.git] / DrawingWindow.cpp
index d1ef81b..5c918ba 100644 (file)
@@ -810,17 +810,10 @@ void DrawingWindow::mousePressEvent(QMouseEvent *ev)
  */
 void DrawingWindow::keyPressEvent(QKeyEvent *ev)
 {
-    bool accept = true;
-    switch (ev->key()) {
-    case Qt::Key_Escape:
+    if (ev->key() == Qt::Key_Escape) {
+        ev->accept();
         close();
-        break;
-    default:
-        accept = false;
-        break;
     }
-    if (accept)
-        ev->accept();
 }
 
 /*!