Example #1
0
void PlotZozPicker::drawTracker( QPainter *painter )
{
    if(painter->isActive()) {
        QString text;
        text.sprintf("%.2f, %.2f",
                     trackerText(trackerPosition()).text().split(",",QString::SkipEmptyParts).at(0).toFloat(),
                     trackerText(trackerPosition()).text().split(",",QString::SkipEmptyParts).at(1).toFloat()
                     );
        emit position(text);
    }
}
Example #2
0
QRect CurveTracker::trackerRect( const QFont &font ) const
{
    QRect r = QwtPlotPicker::trackerRect( font );
    
    // align r to the first curve

    const QwtPlotItemList curves = plot()->itemList( QwtPlotItem::Rtti_PlotCurve );
    if ( curves.size() > 0 )
    {
        QPointF pos = invTransform( trackerPosition() );

        const QLineF line = curveLineAt(    
            static_cast<const QwtPlotCurve *>( curves[0] ), pos.x() );
        if ( !line.isNull() )
        {
            const double curveY = line.pointAt(
                ( pos.x() - line.p1().x() ) / line.dx() ).y();

            pos.setY( curveY );
            pos = transform( pos );

            r.moveBottom( pos.y() );            
        }
    }

    return r;
}
Example #3
0
void CurveTracker::activate(QPointF &p)
{

    this->remove();
    this->end();
    this->begin();
    this->append(p.toPoint());
    this->move(p.toPoint());;


    QPoint pp = trackerPosition();

    //setMouseTracking(true);
}