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

Signed-off-by: Albert S <mail@quitesimple.org>
Esse commit está contido em:
hxbrn 2019-09-01 19:46:38 +02:00 commit de Albert S
commit 19114a0b5d
2 arquivos alterados com 9 adições e 3 exclusões

Ver arquivo

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

Ver arquivo

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