diff --git a/window.cpp b/window.cpp index 917f4e7..99699bc 100644 --- a/window.cpp +++ b/window.cpp @@ -124,6 +124,11 @@ void Window::populateGrid(const QVector &list) void Window::buttonClick(const EntryPushButton &config) { QProcess::startDetached(config.getCommand(), config.getArguments()); + this->closeWindow(); +} + +void Window::closeWindow() +{ if(configProvider->singleInstanceMode()) { this->lineEdit->setText(""); @@ -275,10 +280,10 @@ void Window::keyReleaseEvent(QKeyEvent *event) } void Window::keyPressEvent(QKeyEvent *event) { - bool quit = ((event->modifiers() & Qt::ControlModifier && event->key() == Qt::Key_Q) || event->key() == Qt::Key_Escape); - if(quit) + bool closeWindow = ((event->modifiers() & Qt::ControlModifier && event->key() == Qt::Key_Q) || event->key() == Qt::Key_Escape); + if(closeWindow) { - qApp->quit(); + this->closeWindow(); } if(event->modifiers() & Qt::ControlModifier && buttonsInGrid.count() > 0) diff --git a/window.h b/window.h index 3059216..e0177b8 100644 --- a/window.h +++ b/window.h @@ -66,6 +66,7 @@ private: void addCalcResult(const QString & expression); void initTreeWidgets(); QStringList generatePATHSuggestions(const QString &text); + void closeWindow(); private slots: void lineEditReturnPressed(); void showCalculationResultContextMenu(const QPoint &point);