Skip to content

Commit 66afa28

Browse files
committed
qt, refactor: Replace BitcoinGUI::trayIconActivated with a lambda
1 parent c3ca836 commit 66afa28

File tree

2 files changed

+6
-16
lines changed

2 files changed

+6
-16
lines changed

src/qt/bitcoingui.cpp

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,12 @@ void BitcoinGUI::createTrayIconMenu()
789789
return;
790790

791791
trayIcon->setContextMenu(trayIconMenu.get());
792-
connect(trayIcon, &QSystemTrayIcon::activated, this, &BitcoinGUI::trayIconActivated);
792+
connect(trayIcon, &QSystemTrayIcon::activated, [this](QSystemTrayIcon::ActivationReason reason) {
793+
if (reason == QSystemTrayIcon::Trigger) {
794+
// Click on system tray icon triggers show/hide of the main window
795+
toggleHidden();
796+
}
797+
});
793798
#else
794799
// Note: On macOS, the Dock icon is used to provide the tray's functionality.
795800
MacDockIconHandler *dockIconHandler = MacDockIconHandler::instance();
@@ -822,17 +827,6 @@ void BitcoinGUI::createTrayIconMenu()
822827
#endif
823828
}
824829

825-
#ifndef Q_OS_MAC
826-
void BitcoinGUI::trayIconActivated(QSystemTrayIcon::ActivationReason reason)
827-
{
828-
if(reason == QSystemTrayIcon::Trigger)
829-
{
830-
// Click on system tray icon triggers show/hide of the main window
831-
toggleHidden();
832-
}
833-
}
834-
#endif
835-
836830
void BitcoinGUI::optionsClicked()
837831
{
838832
openOptionsDialogWithTab(OptionsDialog::TAB_MAIN);

src/qt/bitcoingui.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -302,10 +302,6 @@ public Q_SLOTS:
302302
void showDebugWindowActivateConsole();
303303
/** Show help message dialog */
304304
void showHelpMessageClicked();
305-
#ifndef Q_OS_MAC
306-
/** Handle tray icon clicked */
307-
void trayIconActivated(QSystemTrayIcon::ActivationReason reason);
308-
#endif
309305

310306
/** Show window if hidden, unminimize when minimized, rise when obscured or show if hidden and fToggleHidden is true */
311307
void showNormalIfMinimized() { showNormalIfMinimized(false); }

0 commit comments

Comments
 (0)