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:
parent
a900fe5b6c
commit
19114a0b5d
11
window.cpp
11
window.cpp
@ -124,6 +124,11 @@ void Window::populateGrid(const QVector<EntryPushButton *> &list)
|
|||||||
void Window::buttonClick(const EntryPushButton &config)
|
void Window::buttonClick(const EntryPushButton &config)
|
||||||
{
|
{
|
||||||
QProcess::startDetached(config.getCommand(), config.getArguments());
|
QProcess::startDetached(config.getCommand(), config.getArguments());
|
||||||
|
this->closeWindow();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Window::closeWindow()
|
||||||
|
{
|
||||||
if(configProvider->singleInstanceMode())
|
if(configProvider->singleInstanceMode())
|
||||||
{
|
{
|
||||||
this->lineEdit->setText("");
|
this->lineEdit->setText("");
|
||||||
@ -275,10 +280,10 @@ void Window::keyReleaseEvent(QKeyEvent *event)
|
|||||||
}
|
}
|
||||||
void Window::keyPressEvent(QKeyEvent *event)
|
void Window::keyPressEvent(QKeyEvent *event)
|
||||||
{
|
{
|
||||||
bool quit = ((event->modifiers() & Qt::ControlModifier && event->key() == Qt::Key_Q) || event->key() == Qt::Key_Escape);
|
bool closeWindow = ((event->modifiers() & Qt::ControlModifier && event->key() == Qt::Key_Q) || event->key() == Qt::Key_Escape);
|
||||||
if(quit)
|
if(closeWindow)
|
||||||
{
|
{
|
||||||
qApp->quit();
|
this->closeWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(event->modifiers() & Qt::ControlModifier && buttonsInGrid.count() > 0)
|
if(event->modifiers() & Qt::ControlModifier && buttonsInGrid.count() > 0)
|
||||||
|
1
window.h
1
window.h
@ -66,6 +66,7 @@ private:
|
|||||||
void addCalcResult(const QString & expression);
|
void addCalcResult(const QString & expression);
|
||||||
void initTreeWidgets();
|
void initTreeWidgets();
|
||||||
QStringList generatePATHSuggestions(const QString &text);
|
QStringList generatePATHSuggestions(const QString &text);
|
||||||
|
void closeWindow();
|
||||||
private slots:
|
private slots:
|
||||||
void lineEditReturnPressed();
|
void lineEditReturnPressed();
|
||||||
void showCalculationResultContextMenu(const QPoint &point);
|
void showCalculationResultContextMenu(const QPoint &point);
|
||||||
|
Loading…
Reference in New Issue
Block a user