Skip to content

Commit

Permalink
[ref] mainwindow: refactore addAction
Browse files Browse the repository at this point in the history
  • Loading branch information
bgallois committed Aug 1, 2023
1 parent 05d9bd0 commit a0e8991
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,10 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent),
// Tray icon
trayIcon = new QSystemTrayIcon(QIcon(":/assets/icon.svg"), this);
QMenu *trayMenu = new QMenu(this);
QAction *restore = new QAction(tr("Restore"), this);
QAction *restore = trayMenu->addAction(tr("Restore"));
connect(restore, &QAction::triggered, this, &MainWindow::showNormal);
trayMenu->addAction(restore);
QAction *close = new QAction(tr("Close"), this);
QAction *close = trayMenu->addAction(tr("Close"));
connect(close, &QAction::triggered, this, &MainWindow::close);
trayMenu->addAction(close);
connect(trayIcon, &QSystemTrayIcon::activated, this, [this](QSystemTrayIcon::ActivationReason reason) {
switch (reason) {
case QSystemTrayIcon::Trigger: {
Expand Down

0 comments on commit a0e8991

Please sign in to comment.