diff --git a/qtsgraph.cpp b/qtsgraph.cpp index a3263ba..5d8bfd2 100644 --- a/qtsgraph.cpp +++ b/qtsgraph.cpp @@ -117,7 +117,7 @@ int QTSGraph::ReadKey() { if(!EventKeyPressed || IDPressedKey == -1) { - while(!KeyPressed()) + while(!KeyPressed() && this->isVisible()) Delay(100); } int t = IDPressedKey; @@ -211,3 +211,11 @@ void QTSGraph::keyPressEvent(QKeyEvent *event) // Нажатие Esc } } + +void QTSGraph::closeEvent(QCloseEvent *event) +{ + //Закрытие окна + delete ResetTimer; + delete StartTimer; + delete this; +} diff --git a/qtsgraph.h b/qtsgraph.h index 2485f1b..0463c34 100644 --- a/qtsgraph.h +++ b/qtsgraph.h @@ -130,4 +130,5 @@ protected: void paintEvent(QPaintEvent *event) override; void mousePressEvent(QMouseEvent *event) override; void keyPressEvent(QKeyEvent *event) override; + void closeEvent(QCloseEvent *event) override; };