Esc and ctrl+Q decide if quit/hide the app based on config

Signed-off-by: Albert S <mail@quitesimple.org>
This commit is contained in:
hxbrn 2019-09-01 19:46:38 +02:00 committed by Albert S
parent a900fe5b6c
commit 19114a0b5d
2 changed files with 9 additions and 3 deletions

View File

@ -124,6 +124,11 @@ void Window::populateGrid(const QVector<EntryPushButton *> &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)

View File

@ -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);