#include "TTipWidget.h"TTipWidget::TTipWidget()
: mpParent(nullptr)
, mbEnter(false)
, mnTransparent(200)
{
setWindowFlags(Qt::Tool| Qt::FramelessWindowHint |Qt::WindowStaysOnTopHint);
setAlignment(Qt::AlignCenter);
mpTimer= new QTimer(this);
connect(mpTimer,&QTimer::timeout, this, &TTipWidget::OnTimer);
}
TTipWidget::~TTipWidget()
{
deleteLater();
}void TTipWidget::enterEvent(QEvent *)
{
mbEnter= true;
mnTransparent= 200;
setStyleSheet(QString("color:white;font:12px \"Microsoft YaHei\";border-radius:5px;background-color:rgba(80, 80, 80, %1);").arg(mnTransparent));
}void TTipWidget::leaveEvent(QEvent *)
{
mbEnter= false;
}voidTTipWidget::OnTimer()
{if(mbEnter)
{return;<