Implement tray icon click
This commit is contained in:
parent
4bb32f0bd0
commit
1e3596a230
@ -62,6 +62,7 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent)
|
||||
m_trayIcon->setContextMenu(m_trayIconMenu);
|
||||
m_trayIcon->show();
|
||||
m_trayIcon->setToolTip(tr("AdaptiveBrightness"));
|
||||
connect(m_trayIcon, &QSystemTrayIcon::activated, this, &MainWindow::trayIconClicked);
|
||||
|
||||
qDebug(ltr("Tray icon initialized"));
|
||||
}
|
||||
@ -201,3 +202,10 @@ void MainWindow::updateState()
|
||||
m_trayIcon->setToolTip(tr("AdaptiveBrightness - %1%").arg(m_brightness * 100, 0, 'f', 0));
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::trayIconClicked(QSystemTrayIcon::ActivationReason reason)
|
||||
{
|
||||
if(reason == QSystemTrayIcon::ActivationReason::Trigger) {
|
||||
m_showHideAction->trigger();
|
||||
}
|
||||
}
|
||||
|
@ -31,6 +31,8 @@ class MainWindow : public QMainWindow {
|
||||
|
||||
void updateState();
|
||||
|
||||
void trayIconClicked(QSystemTrayIcon::ActivationReason reason);
|
||||
|
||||
Ui::AdaptiveBrightnessClass m_ui;
|
||||
|
||||
std::array<std::unique_ptr<QIcon>, 9> m_noSensorStateIcons;
|
||||
|
Loading…
Reference in New Issue
Block a user