Change window close event to hide window
This commit is contained in:
parent
2253a25011
commit
eb18ab9f1e
@ -5,6 +5,7 @@
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include <QCloseEvent>
|
||||
#include <QGroupBox>
|
||||
#include <QSlider>
|
||||
#include <QtDebug>
|
||||
@ -52,7 +53,7 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent)
|
||||
m_visibility = !m_visibility;
|
||||
});
|
||||
m_trayIconMenu->addSeparator();
|
||||
m_trayIconMenu->addAction(tr("Quit"), this, &QWidget::close);
|
||||
m_trayIconMenu->addAction(tr("Quit"), this, &QCoreApplication::quit);
|
||||
|
||||
qDebug(ltr("Tray icon context menu initialized"));
|
||||
|
||||
@ -88,6 +89,12 @@ MainWindow::~MainWindow()
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::closeEvent(QCloseEvent* event)
|
||||
{
|
||||
m_showHideAction->activate(QAction::Trigger);
|
||||
event->ignore();
|
||||
}
|
||||
|
||||
void MainWindow::loadIcons()
|
||||
{
|
||||
qDebug(ltr("Loading icons"));
|
||||
|
@ -25,6 +25,8 @@ class MainWindow : public QMainWindow {
|
||||
~MainWindow();
|
||||
|
||||
private:
|
||||
void closeEvent(QCloseEvent* event) override;
|
||||
|
||||
void loadIcons();
|
||||
|
||||
void updateState();
|
||||
|
Loading…
Reference in New Issue
Block a user