效果图
初始化说明
void InitStatusTips()
{
if (NULL == statusTips_) {
return;
}
statusTips_->setFixedSize(300, 80);
statusTips_->move((width() - statusTips_->width()) / 2, height() - 30 - statusTips_->height());
statusTips_->setAlignment(Qt::AlignCenter);
statusTips_->setWordWrap(true);
statusTips_->setMinimumHeight(32);
statusTips_->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
statusTips_->setAutoFillBackground(true);
statusTips_->setObjectName("SettingStatusTips");
statusTips_->setMargin(20);
statusTips_->raise();
statusTips_->hide();
statusTime_.setSingleShot(true);
statusTime_.setInterval(3000);
connect(&statusTime_, SIGNAL(timeout()), statusTips_, SLOT(hide()));
connect(&statusTime_, SIGNAL(timeout()), statusTips_, SLOT(lower()));
}
调用说明
void ShowMessage(QString msg)
{
if (NULL == statusTips_) {
return;
}
statusTips_->setText(msg);
statusTips_->raise();
statusTips_->show();
statusTime_.start();
}