void QNotifyMsgBox::HideAction()
{
qDebug() << "HideAction";
// 动画管理器
m_pAnimation = new QPropertyAnimation(this, "windowOpacity");
m_pAnimation->setDuration(QNotifyMsgBoxHideDurationTime);
m_pAnimation->setStartValue(1);
m_pAnimation->setEndValue(0);
connect(m_pAnimation, SIGNAL(finished()), this, SLOT(OnHideWin()));
m_pAnimation->start(QAbstractAnimation::DeleteWhenStopped);
}
void QNotifyMsgBox::OnHideWin()
{
qDebug() << "OnHideWin";
m_pAnimation->stop();
m_pAnimation = NULL;
this->hide();
}
动画暂停与继续
// 鼠标移出信号
void QNotifyMsgBox::leaveEvent(QEvent* )
{
qDebug() << "leaveEvent";
if (m_pAnimation)
{
m_pAnimation->pause();
m_pAnimation->resume();
}
}