void MultiLayer::connectLayer(Graph *g) { connect (g,SIGNAL(drawTextOff()),this,SIGNAL(drawTextOff())); connect (g,SIGNAL(showPlotDialog(long)),this,SIGNAL(showPlotDialog(long))); connect (g,SIGNAL(createTable(const QString&,int,int,const QString&)),this,SIGNAL(createTable(const QString&,int,int,const QString&))); connect (g,SIGNAL(viewLineDialog()),this,SIGNAL(showLineDialog())); connect (g,SIGNAL(showContextMenu()),this,SIGNAL(showGraphContextMenu())); connect (g,SIGNAL(showAxisDialog(int)),this,SIGNAL(showAxisDialog(int))); connect (g,SIGNAL(axisDblClicked(int)),this,SIGNAL(showScaleDialog(int))); connect (g,SIGNAL(xAxisTitleDblClicked()),this,SIGNAL(showXAxisTitleDialog())); connect (g,SIGNAL(yAxisTitleDblClicked()),this,SIGNAL(showYAxisTitleDialog())); connect (g,SIGNAL(rightAxisTitleDblClicked()),this,SIGNAL(showRightAxisTitleDialog())); connect (g,SIGNAL(topAxisTitleDblClicked()),this,SIGNAL(showTopAxisTitleDialog())); connect (g,SIGNAL(showMarkerPopupMenu()),this,SIGNAL(showMarkerPopupMenu())); connect (g,SIGNAL(cursorInfo(const QString&)),this,SIGNAL(cursorInfo(const QString&))); connect (g,SIGNAL(viewImageDialog()),this,SIGNAL(showImageDialog())); connect (g,SIGNAL(createTablePlot(const QString&,int,int,const QString&)),this,SIGNAL(createTablePlot(const QString&,int,int,const QString&))); connect (g,SIGNAL(showPieDialog()),this,SIGNAL(showPieDialog())); connect (g,SIGNAL(viewTitleDialog()),this,SIGNAL(viewTitleDialog())); connect (g,SIGNAL(modifiedGraph()),this,SIGNAL(modifiedPlot())); connect (g,SIGNAL(selectedGraph(Graph*)),this, SLOT(setActiveGraph(Graph*))); connect (g,SIGNAL(viewTextDialog()),this,SIGNAL(showTextDialog())); connect (g,SIGNAL(updateTable(const QString&,int,const QString&)),this,SIGNAL(updateTable(const QString&,int,const QString&))); connect (g,SIGNAL(updateTableColumn(const QString&, double *, int)), this,SIGNAL(updateTableColumn(const QString&, double *, int))); connect (g,SIGNAL(clearCell(const QString&,double)),this,SIGNAL(clearCell(const QString&,double))); connect (g,SIGNAL(moveGraph(Graph*, const QPoint& )),this, SLOT(moveGraph(Graph*, const QPoint&))); connect (g,SIGNAL(releaseGraph(Graph*)),this, SLOT(releaseGraph(Graph*))); connect (g,SIGNAL(modifiedGraph(Graph*)), this, SLOT(updateLayerTransparency(Graph*))); connect (g,SIGNAL(createIntensityTable(const QPixmap&)), this,SIGNAL(createIntensityTable(const QPixmap&))); connect (g,SIGNAL(createHistogramTable(const QString&,int,int,const QString&)), this,SIGNAL(createHistogramTable(const QString&,int,int,const QString&))); //when resizing a layer by mouse-dragging connect (g,SIGNAL(resizeGraph(Graph*, const QPoint& )),this, SLOT(resizeGraph(Graph*, const QPoint&))); connect (g,SIGNAL(newSizeGraph(Graph*)),this, SLOT(newSizeGraph(Graph*))); }
void MultiLayer::connectLayer(Graph *g) { connect(g, SIGNAL(drawLineEnded(bool)), this, SIGNAL(drawLineEnded(bool))); connect(g, SIGNAL(drawTextOff()), this, SIGNAL(drawTextOff())); connect(g, SIGNAL(showPlotDialog(int)), this, SIGNAL(showPlotDialog(int))); connect( g, SIGNAL(createTable(const QString &, const QString &, QList<Column *>)), this, SIGNAL(createTable(const QString &, const QString &, QList<Column *>))); connect(g, SIGNAL(viewLineDialog()), this, SIGNAL(showLineDialog())); connect(g, SIGNAL(showContextMenu()), this, SIGNAL(showGraphContextMenu())); connect(g, SIGNAL(showLayerButtonContextMenu()), this, SIGNAL(showLayerButtonContextMenu())); connect(g, SIGNAL(showAxisDialog(int)), this, SIGNAL(showAxisDialog(int))); connect(g, SIGNAL(axisDblClicked(int)), this, SIGNAL(showScaleDialog(int))); connect(g, SIGNAL(xAxisTitleDblClicked()), this, SIGNAL(showXAxisTitleDialog())); connect(g, SIGNAL(yAxisTitleDblClicked()), this, SIGNAL(showYAxisTitleDialog())); connect(g, SIGNAL(rightAxisTitleDblClicked()), this, SIGNAL(showRightAxisTitleDialog())); connect(g, SIGNAL(topAxisTitleDblClicked()), this, SIGNAL(showTopAxisTitleDialog())); connect(g, SIGNAL(showMarkerPopupMenu()), this, SIGNAL(showMarkerPopupMenu())); connect(g, SIGNAL(showCurveContextMenu(int)), this, SIGNAL(showCurveContextMenu(int))); connect(g, SIGNAL(cursorInfo(const QString &)), this, SIGNAL(cursorInfo(const QString &))); connect(g, SIGNAL(viewImageDialog()), this, SIGNAL(showImageDialog())); connect(g, SIGNAL(viewTitleDialog()), this, SIGNAL(viewTitleDialog())); connect(g, SIGNAL(modifiedGraph()), this, SIGNAL(modifiedPlot())); connect(g, SIGNAL(selectedGraph(Graph *)), this, SLOT(setActiveGraph(Graph *))); connect(g, SIGNAL(viewTextDialog()), this, SIGNAL(showTextDialog())); connect(g, SIGNAL(createIntensityTable(const QString &)), this, SIGNAL(createIntensityTable(const QString &))); }
bool CanvasPicker::eventFilter(QObject *object, QEvent *e) { QVector<int> images = plot()->imageMarkerKeys(); QVector<int> lines = plot()->lineMarkerKeys(); if (object != (QObject *)plot()->plotWidget()->canvas()) return false; switch(e->type()) { case QEvent::MouseButtonPress: { plot()->deselect(); emit selectPlot(); const QMouseEvent *me = (const QMouseEvent *)e; bool allAxisDisabled = true; for (int i=0; i < QwtPlot::axisCnt; i++){ if (plotWidget->axisEnabled(i)){ allAxisDisabled = false; break; } } int dist, point; plotWidget->closestCurve(me->pos().x(), me->pos().y(), dist, point); if (me->button() == Qt::LeftButton && (plot()->drawLineActive())){ startLinePoint = me->pos(); return true; } if (me->button() == Qt::LeftButton && plot()->drawTextActive()){ drawTextMarker(me->pos()); return true; } if (!plot()->zoomOn() && selectMarker(me)){ if (me->button() == Qt::RightButton) emit showMarkerPopupMenu(); return true; } return !(me->modifiers() & Qt::ShiftModifier); } break; case QEvent::MouseButtonDblClick: { if (d_editing_marker) { return d_editing_marker->eventFilter(plotWidget->canvas(), e); } else if (plot()->selectedMarkerKey() >= 0) { if (lines.contains(plot()->selectedMarkerKey())){ emit viewLineDialog(); return true; } else if (images.contains(plot()->selectedMarkerKey())){ emit viewImageDialog(); return true; } } else if (plot()->isPiePlot()){ emit showPlotDialog(plot()->curveKey(0)); return true; } else { const QMouseEvent *me = (const QMouseEvent *)e; int dist, point; int curveKey = plotWidget->closestCurve(me->pos().x(), me->pos().y(), dist, point); if (dist < 10) emit showPlotDialog(curveKey); else emit showPlotDialog(-1); return true; } } break; case QEvent::MouseMove: { const QMouseEvent *me = (const QMouseEvent *)e; if (me->state() != Qt::LeftButton) return true; QPoint pos = me->pos(); DataCurve *c = plot()->selectedCurveLabels(); if (c){ c->moveLabels(pos); return true; } if (plot()->drawLineActive()) { drawLineMarker(pos, plot()->drawArrow()); return true; } return false; } break; case QEvent::MouseButtonRelease: { const QMouseEvent *me = (const QMouseEvent *)e; Graph *g = plot(); if (g->drawLineActive()) { ApplicationWindow *app = g->multiLayer()->applicationWindow(); if (!app) return true; ArrowMarker mrk; mrk.attach(g->plotWidget()); mrk.setStartPoint(startLinePoint); mrk.setEndPoint(QPoint(me->x(), me->y())); mrk.setColor(app->defaultArrowColor); mrk.setWidth(app->defaultArrowLineWidth); mrk.setStyle(app->defaultArrowLineStyle); mrk.setHeadLength(app->defaultArrowHeadLength); mrk.setHeadAngle(app->defaultArrowHeadAngle); mrk.fillArrowHead(app->defaultArrowHeadFill); mrk.drawEndArrow(g->drawArrow()); mrk.drawStartArrow(false); g->addArrow(&mrk); g->drawLine(false); mrk.detach(); plotWidget->replot(); return true; } /*if(plot()->zoomOn()) { //fix for colormap changing on releasing the mouse button after zooming Graph * gr=plot(); if(!gr) return NULL; Spectrogram * spectrogram=gr->getSpectrogram(); if(spectrogram) spectrogram->setupColorBarScaling(); }*/ return false; } break; case QEvent::KeyPress: { int key=((const QKeyEvent *)e)->key(); int selectedMarker = plot()->selectedMarkerKey(); if (lines.contains(selectedMarker) && (key==Qt::Key_Enter || key==Qt::Key_Return)) { emit viewLineDialog(); return true; } if (images.contains(selectedMarker) && (key==Qt::Key_Enter || key==Qt::Key_Return)) { emit viewImageDialog(); return true; } } break; default: break; } return QObject::eventFilter(object, e); }