The message window will not switch to the top if you click the network Settings button again(已打开网络设置,影藏,再次点击网络设置按钮消息窗口不会切换到最上方)

This commit is contained in:
liushanwen 2021-01-25 19:43:06 +08:00
parent 42258d7f6b
commit 3cd62a9332
2 changed files with 19 additions and 4 deletions

View File

@ -76,7 +76,8 @@ MainWindow::MainWindow(QWidget *parent) :
createTrayIcon(); createTrayIcon();
connect(trayIcon, &QSystemTrayIcon::activated, this, &MainWindow::iconActivated); connect(trayIcon, &QSystemTrayIcon::activated, this, &MainWindow::iconActivated);
connect(mShowWindow,SIGNAL(triggered()),this,SLOT(on_showWindowAction())); connect(mShowWindow,SIGNAL(triggered()),this,SLOT(on_showWindowAction()));
connect(mAdvConf,SIGNAL(triggered()),this,SLOT(on_btnAdvConf_clicked())); connect(mAdvConf, &QAction::triggered, this, &MainWindow::actionTriggerSlots);
trayIcon->show(); trayIcon->show();
objKyDBus = new KylinDBus(this); objKyDBus = new KylinDBus(this);
@ -668,7 +669,7 @@ void MainWindow::iconActivated(QSystemTrayIcon::ActivationReason reason)
break; break;
case QSystemTrayIcon::Context: case QSystemTrayIcon::Context:
//右键点击托盘图标弹出菜单 //右键点击托盘图标弹出菜单
showTrayIconMenu(); // showTrayIconMenu();
break; break;
default: default:
break; break;
@ -2111,8 +2112,9 @@ void MainWindow::on_btnAdvConf_clicked()
// QProcess *qprocess = new QProcess(this); // QProcess *qprocess = new QProcess(this);
// qprocess->start("nm-connection-editor &"); // qprocess->start("nm-connection-editor &");
// } // }
QProcess *qprocess = new QProcess(this); QProcess p(0);
qprocess->start("nm-connection-editor &"); p.startDetached("nm-connection-editor &");
p.waitForStarted();
return; return;
} }
@ -2182,6 +2184,18 @@ void MainWindow::onBtnCreateNetClicked()
m_cf->exec(); m_cf->exec();
} }
/* 右键菜单打开网络设置界面 */
void MainWindow::actionTriggerSlots()
{
this->move(-500, -500);
this->showNormal();
this->raise();
this->activateWindow();
QProcess p(0);
p.startDetached("nm-connection-editor &");
p.waitForStarted();
return;
}
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
//处理窗口变化、网络状态变化 //处理窗口变化、网络状态变化

View File

@ -335,6 +335,7 @@ private slots:
void onBtnAddNetClicked(); void onBtnAddNetClicked();
void onBtnCreateNetClicked(); void onBtnCreateNetClicked();
void actionTriggerSlots();
signals: signals:
void disConnSparedNet(QString type); void disConnSparedNet(QString type);