summaryrefslogtreecommitdiffstats
path: root/tests/manual/examples/widgets/widgets/validators/ledwidget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/manual/examples/widgets/widgets/validators/ledwidget.cpp')
-rw-r--r--tests/manual/examples/widgets/widgets/validators/ledwidget.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/manual/examples/widgets/widgets/validators/ledwidget.cpp b/tests/manual/examples/widgets/widgets/validators/ledwidget.cpp
new file mode 100644
index 0000000000..5b95595a75
--- /dev/null
+++ b/tests/manual/examples/widgets/widgets/validators/ledwidget.cpp
@@ -0,0 +1,25 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+#include "ledwidget.h"
+
+LEDWidget::LEDWidget(QWidget *parent)
+ : QLabel(parent), onPixmap(":/ledon.png"), offPixmap(":/ledoff.png")
+{
+ setPixmap(offPixmap);
+ flashTimer.setInterval(200);
+ flashTimer.setSingleShot(true);
+ connect(&flashTimer, &QTimer::timeout, this, &LEDWidget::extinguish);
+};
+
+void LEDWidget::extinguish()
+{
+ setPixmap(offPixmap);
+}
+
+void LEDWidget::flash()
+{
+ setPixmap(onPixmap);
+ flashTimer.start();
+}
+