diff --git a/lightbutton/lightbutton.cpp b/lightbutton/lightbutton.cpp index 76e01a1..eded620 100644 --- a/lightbutton/lightbutton.cpp +++ b/lightbutton/lightbutton.cpp @@ -28,6 +28,7 @@ LightButton::LightButton(QWidget *parent) : QWidget(parent) canMove = false; this->installEventFilter(this); + isAlarm = false; timerAlarm = new QTimer(this); connect(timerAlarm, SIGNAL(timeout()), this, SLOT(alarm())); timerAlarm->setInterval(500); @@ -435,7 +436,6 @@ void LightButton::stopAlarm() void LightButton::alarm() { - static bool isAlarm = false; if (isAlarm) { textColor = QColor(255, 255, 255); bgColor = normalColor; diff --git a/lightbutton/lightbutton.h b/lightbutton/lightbutton.h index 7406832..09b1822 100644 --- a/lightbutton/lightbutton.h +++ b/lightbutton/lightbutton.h @@ -76,6 +76,7 @@ private: bool showOverlay; //是否显示遮罩层 QColor overlayColor; //遮罩层颜色 + bool isAlarm; //是否报警 QTimer *timerAlarm; //定时器切换颜色 public: