/// Record the point that the user is currently pointing in the scales coordinates
void SpectrumDisplay::setPointedAtXY( double x, double y, bool isFront ) {
    setHGraph( y, isFront );
    setVGraph( x, isFront );

    if (isFront) {
        showInfoList( x, y );
        foreach(boost::weak_ptr<SpectrumDisplay> sd, m_otherDisplays) {
            if (auto display = sd.lock()) {
                display->setPointedAtXY(x, y, false);
            }
        }
    }
}
Example #2
0
/**
 * Show information about the specified point.
 *
 * @param point  The point that the user is currently pointing at with
 *               the mouse.
 */
void GraphDisplay::setPointedAtPoint(QPoint point) {
  if (m_dataSource == 0) {
    return;
  }
  double x = m_graphPlot->invTransform(QwtPlot::xBottom, point.x());
  double y = m_graphPlot->invTransform(QwtPlot::yLeft, point.y());

  if (m_isVertical) // x can be anywhere on graph, y must be
  {                 // a valid data source position, vertically
    m_dataSource->restrictY(y);
  } else // y can be anywhere on graph, x must be
  {      // a valid data source position, horizontally
    m_dataSource->restrictX(x);
  }

  showInfoList(x, y);
}