Click tray icon to raise

master
tobtoht 4 years ago
parent 50d83bd988
commit 0c09718405
Signed by: tobtoht
GPG Key ID: 1CADD27F41F45C3C

@ -34,12 +34,17 @@ MainWindow::MainWindow(QWidget *parent) :
daemonManager->setMonerodPath(monerodPath);
connect(daemonManager, &DaemonManager::daemonConsoleUpdated, this, &MainWindow::writeLogLine);
connect(m_showWindow, &QAction::triggered, [this]{
this->show();
this->raise();
this->activateWindow();
this->setFocus();
connect(m_trayIcon, &QSystemTrayIcon::activated, [this](QSystemTrayIcon::ActivationReason reason){
switch (reason) {
case QSystemTrayIcon::ActivationReason::Trigger:
case QSystemTrayIcon::ActivationReason::DoubleClick:
case QSystemTrayIcon::ActivationReason::MiddleClick:
this->showWindow();
default:
break;
}
});
connect(m_showWindow, &QAction::triggered, this, &MainWindow::showWindow);
connect(ui->btn_Configure, &QPushButton::clicked, this, &MainWindow::showConfigurator);
connect(ui->commandPrompt, &CommandLineEdit::commandExecuted, this, &MainWindow::sendCommand);
@ -228,6 +233,13 @@ QString MainWindow::loadStylesheet(const QString &resource) {
return data;
}
void MainWindow::showWindow() {
this->show();
this->raise();
this->activateWindow();
this->setFocus();
}
MainWindow::~MainWindow()
{
delete ui;

@ -34,6 +34,7 @@ private:
int getPort();
QString defaultMonerodPath();
QString loadStylesheet(const QString &resource);
void showWindow();
Ui::MainWindow *ui;
@ -42,9 +43,6 @@ private:
QAction *m_stopDaemon;
QAction *m_showWindow;
DaemonManager *daemonManager;
};

Loading…
Cancel
Save