From a0e89912c34016b42e21daf1a44f1b1a0580f949 Mon Sep 17 00:00:00 2001 From: bgallois Date: Tue, 1 Aug 2023 16:24:18 +0200 Subject: [PATCH] [ref] mainwindow: refactore addAction --- src/mainwindow.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 3ffb980..49dc6fd 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -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: {