feat:初始化wuhan_QT界面代码
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
#include "alarmbanner.h"
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include "global.h"
|
||||
|
||||
AlarmBanner::AlarmBanner(QWidget* parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
setFixedHeight(54);
|
||||
setStyleSheet("background: transparent;");
|
||||
|
||||
QHBoxLayout* lay = new QHBoxLayout(this);
|
||||
lay->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
m_label = new QLabel(this);
|
||||
m_label->setAlignment(Qt::AlignCenter);
|
||||
m_label->setProperty("alert", true);
|
||||
m_label->setStyleSheet("font-size:30px;font-weight:700;");
|
||||
lay->addWidget(m_label);
|
||||
|
||||
hide(); // 默认隐藏
|
||||
}
|
||||
|
||||
void AlarmBanner::showAlarm(const QString& text)
|
||||
{
|
||||
m_label->setText(text);
|
||||
startBlink(m_label, "blink");
|
||||
show();
|
||||
}
|
||||
|
||||
void AlarmBanner::clear()
|
||||
{
|
||||
stopBlink(m_label, "blink");
|
||||
hide();
|
||||
}
|
||||
Reference in New Issue
Block a user