提交 2a120208 编写于 作者: M manjaro

解决了任务栏图标无法关闭的问题

上级 f1d278b8
...@@ -123,7 +123,8 @@ void ZPMainFrame::changeEvent(QEvent *e) ...@@ -123,7 +123,8 @@ void ZPMainFrame::changeEvent(QEvent *e)
if (this->isMinimized()==true) if (this->isMinimized()==true)
{ {
this->hide(); this->hide();
this->m_IconTray->showMessage(tr("Server still running"), if (m_IconTray)
this->m_IconTray->showMessage(tr("Server still running"),
tr("If you want to terminate server, just using exit Toolbar button.")); tr("If you want to terminate server, just using exit Toolbar button."));
} }
break; break;
...@@ -384,12 +385,15 @@ void ZPMainFrame::timerEvent(QTimerEvent * e) ...@@ -384,12 +385,15 @@ void ZPMainFrame::timerEvent(QTimerEvent * e)
static int ppIc = 0; static int ppIc = 0;
lastRecieved = g_bytesRecieved; lastRecieved = g_bytesRecieved;
lastSent = g_bytesSent; lastSent = g_bytesSent;
if (++ppIc % 2==0) if (m_IconTray)
m_IconTray->setIcon(QIcon(":/icons/Resources/Color Classic Green.png")); {
else if (++ppIc % 2==0)
m_IconTray->setIcon(QIcon(":/icons/Resources/Color Classic, Performa 250, 275.png")); m_IconTray->setIcon(QIcon(":/icons/Resources/Color Classic Green.png"));
else
m_IconTray->setIcon(QIcon(":/icons/Resources/Color Classic, Performa 250, 275.png"));
}
} }
else else if (m_IconTray)
{ {
m_IconTray->setIcon(QIcon(":/icons/Resources/Color Classic.png")); m_IconTray->setIcon(QIcon(":/icons/Resources/Color Classic.png"));
} }
...@@ -974,21 +978,27 @@ void ZPMainFrame::closeEvent(QCloseEvent * e) ...@@ -974,21 +978,27 @@ void ZPMainFrame::closeEvent(QCloseEvent * e)
if (this->isVisible()==true) if (this->isVisible()==true)
{ {
this->hide(); this->hide();
this->m_IconTray->showMessage(tr("Server still running"), if (m_IconTray)
this->m_IconTray->showMessage(tr("Server still running"),
tr("If you want to terminate server, just using exit Toolbar button.")); tr("If you want to terminate server, just using exit Toolbar button."));
e->ignore(); e->ignore();
} }
else else
{ {
e->accept(); if (m_IconTray)
this->m_IconTray->showMessage(tr("Server is going to closed"), this->m_IconTray->showMessage(tr("Server is going to closed"),
tr("Waiting for all unfinished progress...")); tr("Waiting for all unfinished progress..."));
e->accept();
m_IconTray->deleteLater();
m_IconTray = nullptr;
} }
} }
void ZPMainFrame::on_actionExit_triggered() void ZPMainFrame::on_actionExit_triggered()
{ {
this->hide(); this->hide();
this->m_IconTray->setContextMenu(0); if (m_IconTray)
this->m_IconTray->setContextMenu(0);
this->close(); this->close();
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册