int caClock::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QwtAnalogClock::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 2) qt_static_metacall(this, _c, _id, _a); _id -= 2; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< QString*>(_v) = getPV(); break; case 1: *reinterpret_cast< timeType*>(_v) = getTimeType(); break; case 2: *reinterpret_cast< QColor*>(_v) = getBaseColor(); break; case 3: *reinterpret_cast< bool*>(_v) = getScaleDefaultColor(); break; case 4: *reinterpret_cast< QColor*>(_v) = getScaleColor(); break; case 5: *reinterpret_cast< colMode*>(_v) = getColorMode(); break; } _id -= 6; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setPV(*reinterpret_cast< QString*>(_v)); break; case 1: setTimeType(*reinterpret_cast< timeType*>(_v)); break; case 2: setBaseColor(*reinterpret_cast< QColor*>(_v)); break; case 3: setScaleDefaultColor(*reinterpret_cast< bool*>(_v)); break; case 4: setScaleColor(*reinterpret_cast< QColor*>(_v)); break; case 5: setColorMode(*reinterpret_cast< colMode*>(_v)); break; } _id -= 6; } else if (_c == QMetaObject::ResetProperty) { _id -= 6; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 6; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 6; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 6; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 6; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 6; } #endif // QT_NO_PROPERTIES return _id; }
caStripPlot::caStripPlot(QWidget *parent): QwtPlot(parent) { timerID = false; thisXaxisType = TimeScale; HISTORY = 60; thisUnits = Second; thisPeriod = 60; NumberOfCurves = MAXCURVES; onInit = true; timeInterval = 1.0; setAutoReplot(false); setAutoFillBackground(true); Start = true; // define a grid plotGrid = new QwtPlotGrid(); plotGrid->attach(this); plotLayout()->setAlignCanvasToScales(true); // define our axis if(thisXaxisType == TimeScale) { setAxisScale(QwtPlot::xBottom, 0, HISTORY); } else { setAxisScale(QwtPlot::xBottom, -HISTORY, 0); } setAxisLabelAlignment(QwtPlot::xBottom, Qt::AlignLeft | Qt::AlignBottom); setAxisScale(QwtPlot::yLeft, 0, 1000); if(thisXaxisType == TimeScale) { // due to time scale we need some distance scaleWidget = axisWidget(QwtPlot::xBottom); const int fmh = QFontMetrics(scaleWidget->font()).height(); scaleWidget->setMinBorderDist(fmh * 2, fmh * 2); // define time axis QTime timeNow= QTime::currentTime(); setAxisScaleDraw ( QwtPlot::xBottom, new TimeScaleDraw ( timeNow ) ); } // define our curves for(int i=0; i< MAXCURVES; i++) { curve[i] = new QwtPlotCurve(); errorcurve[i] = new QwtPlotIntervalCurve(); fillcurve[i] = new QwtPlotIntervalCurve(); if(i>0) { curve[i]->setZ(curve[i]->z() - i); fillcurve[i]->setZ(fillcurve[i]->z() - i); errorcurve[i]->setZ(errorcurve[i]->z() - i); } curve[i]->attach(this); errorcurve[i]->attach(this); fillcurve[i]->attach(this); showCurve(i, false); thisYaxisLimitsMax[i] = 100; thisYaxisLimitsMin[i] = 0; } // default colors and styles setTitlePlot(""); setTitleX(""); setTitleY(""); setBackground(Qt::black); setForeground(QColor(133, 190, 232)); setScaleColor(Qt::black); setGrid(true); setGridColor(Qt::gray); for(int i=0; i< MAXCURVES; i++) setStyle(Lines, i); setColor(Qt::white, 0); setColor(Qt::red, 1); setColor(Qt::yellow, 2); setColor(Qt::cyan, 3); setColor(Qt::magenta, 4); setColor(Qt::green, 5); setColor(Qt::blue, 6); setXaxisEnabled(true); setYaxisEnabled(true); setLegendEnabled(true); setAxisFont(QwtPlot::xBottom, QFont("Arial", 10)); setAxisFont(QwtPlot::yLeft, QFont("Arial", 10)); installEventFilter(this); // display timer Timer = new QTimer(this); Timer->setInterval(1000); connect(Timer, SIGNAL(timeout()), this, SLOT(TimeOut())); // data collection thread timerThread = new stripplotthread(); timerThread->start(); timerThread->threadSetTimer(100); timerThread->setPriority(QThread::HighPriority); connect(this, SIGNAL(timerThreadStop()), timerThread, SLOT(runStop())); connect(timerThread, SIGNAL(update()), this, SLOT(TimeOutThread()), Qt::DirectConnection); }