void plotter::keyPressEvent(QKeyEvent *event) { switch (event->key()) { case Qt::Key_Plus: zoomIn(); break; case Qt::Key_Minus: zoomOut(); break; case Qt::Key_Left: zoomStack[curZoom].scroll(-1, 0); refreshPixmap(); break; case Qt::Key_Right: zoomStack[curZoom].scroll(+1, 0); refreshPixmap(); break; case Qt::Key_Down: zoomStack[curZoom].scroll(0, -1); refreshPixmap(); break; case Qt::Key_Up: zoomStack[curZoom].scroll(0, +1); refreshPixmap(); break; default: QWidget::keyPressEvent(event); } }
void plotter::setPlotSettings(const PlotSettings &settings) { zoomStack.clear(); zoomStack.append(settings); curZoom = 0; refreshPixmap(); }
void Plotter::resizeEvent(QResizeEvent * /* event */) { int x = width() - (zoomInButton->width() + zoomOutButton->width() + 10); zoomInButton->move(x, 5); zoomOutButton->move(x + zoomInButton->width() + 5, 5); refreshPixmap(); }
void plotter::zoomOut() { if (curZoom > 0) { --curZoom; refreshPixmap(); } }
LayerItem::LayerItem(Qt::BrushStyle brushStyle, qreal heightRatio, qreal lengthRatio, QWidget *parent) : QWidget(parent), _brushStyle(brushStyle), _heightRatio(heightRatio), _lengthRatio(lengthRatio) { setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); setAttribute(Qt::WA_DeleteOnClose); refreshPixmap(); }
void plotter::zoomIn() { if (curZoom < zoomStack.count() - 1) { ++curZoom; refreshPixmap(); } }
void WaveformPlot::setMode(int _mode) { mode = _mode; delete waveForm; waveForm = new LinearSynthesis(mode); refreshPixmap(); }
void Plotter::updateZoom(QRect pRect,PlotSettings pSettings) { setRubberBandRect(&pRect); m_ZoomSettings = new PlotSettings(); m_ZoomSettings = &pSettings; m_moveFlag = true; refreshPixmap(); }
void Plotter::setBandData(int pID,QVector<QPointF> &data,double pBand) { bandMap[pID] = data; m_objPlotData->m_nEnvelopBand = pBand; // qDebug() << "Band:"<<m_objPlotData->m_nEnvelopBand; generateCompareValues(pID); refreshPixmap(); }
void plotter::setPlotSettings(const PlotSettings &settings) { zoomStack.clear(); zoomStack.append(settings); curZoom = 0; zoomInButton->hide(); zoomOutButton->hide(); refreshPixmap(); }
void Plotter::clearBand(int pID) { if(bandMap.contains(pID)) { bandMap.remove(pID); refreshPixmap(); } }
void plotter::zoomIn() { if(curZoom < zoomStack.count() - 1){ ++curZoom; zoomInButton->setEnabled(curZoom < zoomStack.count() - 1); zoomOutButton->setEnabled(true); zoomOutButton->show(); refreshPixmap(); } }
void plotter::zoomOut() { if(curZoom > 0){ --curZoom; zoomOutButton->setEnabled(curZoom > 0); zoomInButton->setEnabled(true); zoomInButton->show(); refreshPixmap(); } }
void Plotter::wheelEvent(QWheelEvent *event) { int numDegrees = event->delta() /8; int numTicks = numDegrees / 15; if(event->orientation() == Qt::Horizontal) zoomStack[curZoom].scroll(numTicks,0); else zoomStack[curZoom].scroll(0,numTicks); refreshPixmap(); }
void Plotter::clearCurve(int pID) { //for(int l_nIndex=0;l_nIndex< curveMap.count();l_nIndex++) 496213 // curveMap.remove(l_nIndex); if(curveMap.contains(pID)) { curveMap.remove(pID); refreshPixmap(); } }
void Plotter::clearCurve(int pID) { //for(int l_nIndex=0;l_nIndex< curveMap.count();l_nIndex++) 496213 // curveMap.remove(l_nIndex); m_bClearTrace = true; m_nClearID = pID; //qDebug()<<"Clear Curve Trace Index:" << m_nClearID; if(curveMap.contains(pID)) { curveMap.remove(pID); refreshPixmap(); } }
void Graph::curveMapper() { static int i = 0; pointStorage_0.append(QPoint(axsTime_0, axsValue_0)); pointStorage_1.append(QPoint(axsTime_1, axsValue_1)); axsTime_0++; axsTime_1++; axsValue_0 += 2; axsValue_1 += 1; i++; refreshPixmap(); }
void Plotter::wheelEvent(QWheelEvent *event) { //the distance the wheel was rotated in eighths of a degree int numDegrees = event->delta() / 8; int numTicks = numDegrees / 15; if (event->orientation() == Qt::Horizontal) { zoomStack[curZoom].scroll(numTicks, 0); } else { zoomStack[curZoom].scroll(0, numTicks); } refreshPixmap(); }
Graph::Graph(QWidget *parent) : QWidget(parent), axsTime_0(0), axsTime_1(0), axsValue_0(0), axsValue_1(0) { setBackgroundRole(QPalette::Dark); setAutoFillBackground(true); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); setFocusPolicy(Qt::StrongFocus); rubberBandIsShown = false; refreshPixmap(); timer = new QTimer(); connect(timer, SIGNAL(timeout()), this, SLOT(curveMapper())); //QTimer::singleShot(5000, this, SLOT(startCount())); }
void Plotter::setCurveData(int pID,const QVector<QPointF> & pData) { // qDebug() << "CurveID"<<pID; // loopMap.clear(); // if(m_nLoopDrive){ // //loopMap = pData; // //refreshlGrid(); // } // else // { // curveMap[pID] = pData; // refreshPixmap(); // } curveMap[pID] = pData; refreshPixmap();//added for VI grap hide in multiple traces. }
void FFTPlot::fftUpdate(fftw_complex *out, unsigned int size, unsigned int ind_dataset) { Q_ASSERT(ind_dataset < numPlots); if (fftSizes[ind_dataset] != size) { if (fftSizes[ind_dataset] > 0) { delete [] fftAmpls[ind_dataset]; } fftSizes[ind_dataset] = size; fftAmpls[ind_dataset] = new qreal[size]; } qreal *fftAmpl = fftAmpls[ind_dataset]; for (unsigned int ind=0; ind < fftSizes[ind_dataset]; ind++) { qreal re = out[ind][0], im = out[ind][1]; fftAmpl[ind] = 0.5*qSqrt(re*re + im*im)/fftSizes[ind_dataset]; if (fftAmpl[ind] == 0) { fftAmpl[ind] = minampl; } } refreshPixmap(); }
void FFTPlot::fftUpdate(std::complex<qreal> *out, unsigned int size, unsigned int ind_dataset) { Q_ASSERT(ind_dataset < numPlots); // qDebug() << ind_dataset << size; if (fftSizes[ind_dataset] != size) { if (fftSizes[ind_dataset] > 0) { delete [] fftAmpls[ind_dataset]; } fftSizes[ind_dataset] = size; fftAmpls[ind_dataset] = new qreal[size]; } qreal *fftAmpl = fftAmpls[ind_dataset]; for (unsigned int ind=0; ind < fftSizes[ind_dataset]; ind++) { qreal re = out[ind].real(), im = out[ind].imag(); fftAmpl[ind] = 0.5*qSqrt(re*re + im*im)/fftSizes[ind_dataset]; if (fftAmpl[ind] == 0) { fftAmpl[ind] = minampl; } } refreshPixmap(); }
void plotter::clearCurve(int id) { curveMap.remove(id); refreshPixmap(); }
void plotter::resizeEvent(QResizeEvent * /* event */) { refreshPixmap(); }
void plotter::setCurveData(int id, const QVector<QPointF> &data) { curveMap[id] = data; refreshPixmap(); }
void Plotter::setCurveData(int pID,const QVector<QPointF> & pData) { curveMap[pID] = pData; refreshPixmap(); }
void WaveformPlot::resizeEvent(QResizeEvent *event) { refreshPixmap(); Q_UNUSED(event); }
void Plotter::resizeEvent(QResizeEvent *event) { //Q_UNUSED(event); refreshPixmap(); }
void WaveformPlot::setTimbre(QVector<int> &litudes, QVector<int> &phases) { waveForm->setTimbre(amplitudes, phases); refreshPixmap(); }
void Plotter::keyPressEvent(QKeyEvent *event) { switch(event->key()) { case Qt::Key_Right: if(rubberBandRect.x() < this->width()-(rubberBandRect.width()-10)) { rubberBandRect.setLeft(rubberBandRect.x() + 10); rubberBandRect.setWidth(rubberBandRect.width()+10); updateRubberBandRegion(); } break; case Qt::Key_Left: if(rubberBandRect.x() > 10){ rubberBandRect.setLeft(rubberBandRect.x() - 10); rubberBandRect.setWidth(rubberBandRect.width()-10); updateRubberBandRegion(); } break; case Qt::Key_Down: if(rubberBandRect.y() < this->height()-rubberBandRect.height()){ rubberBandRect.setTop(rubberBandRect.y() + 10); rubberBandRect.setHeight(rubberBandRect.height()+10); updateRubberBandRegion(); } break; case Qt::Key_Up: if(rubberBandRect.y() >0){ rubberBandRect.setTop(rubberBandRect.y() - 10); rubberBandRect.setHeight(rubberBandRect.height()-10); updateRubberBandRegion(); } break; default: QWidget::keyPressEvent(event); } QRect rect = rubberBandRect.normalized(); if(rect.width() < 4 || rect.height() < 4 ) { return; } rect.translate(-Margin,-Margin); PlotSettings prevSettings = zoomStack[curZoom]; PlotSettings settings; settings.m_nOffset = prevSettings.m_nOffset; double dx = prevSettings.spanX() / (width()-2*Margin); double dy = prevSettings.spanY() / (height()-2*Margin); settings.minX = prevSettings.minX + dx * rect.left(); settings.maxX = prevSettings.minX + dx * rect.right(); settings.minY = prevSettings.maxY - dy * rect.bottom(); settings.maxY = prevSettings.maxY - dy * rect.top(); settings.adjust(); PlotSettings *pTemp = new PlotSettings(); pTemp = &settings; zoomStack.resize(curZoom + 1); zoomStack.append(settings); refreshPixmap(); emit moveWindow(rubberBandRect,settings); }