# HG changeset patch # User Hasan Yavuz Ă–ZDERYA # Date 2015-06-22 06:32:11 # Node ID d4f23bf96cf5d9e64f5483150c5fd3b1c719606a # Parent aa93a4eacbb99f7ec79760c96c0cd94eb38022ae added demo mode indicator diff --git a/mainwindow.cpp b/mainwindow.cpp --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -143,6 +143,15 @@ MainWindow::MainWindow(QWidget *parent) this, &MainWindow::demoTimerTimeout); QObject::connect(ui->actionDemoMode, &QAction::toggled, this, &MainWindow::enableDemo); + + { // init demo indicator + QwtText demoText("DEMO RUNNING"); + demoText.setColor(QColor("red")); + demoText.setRenderFlags(Qt::AlignLeft | Qt::AlignTop); + demoIndicator.setText(demoText); + demoIndicator.hide(); + demoIndicator.attach(ui->plot); + } } MainWindow::~MainWindow() @@ -570,6 +579,8 @@ void MainWindow::enableDemo(bool enabled { demoTimer.start(); ui->actionDemoMode->setChecked(true); + demoIndicator.show(); + ui->plot->replot(); } else { @@ -580,6 +591,8 @@ void MainWindow::enableDemo(bool enabled { demoTimer.stop(); ui->actionDemoMode->setChecked(false); + demoIndicator.hide(); + ui->plot->replot(); } } diff --git a/mainwindow.h b/mainwindow.h --- a/mainwindow.h +++ b/mainwindow.h @@ -31,6 +31,7 @@ #include #include #include +#include #include "portcontrol.h" #include "ui_about_dialog.h" @@ -96,6 +97,7 @@ private: QTimer demoTimer; int demoCount; bool isDemoRunning(); + QwtPlotTextLabel demoIndicator; QColor makeColor(unsigned int channelIndex);