10 Nisan 2018 Salı

QWT3 Canvasa Dikey Çizgi ile Koordinat takibi Yapmak (Curve Travker - QwtPlotPicker)

    CurveTracker* tracker = new CurveTracker( this->canvas() );

    // for the demo we want the tracker to be active without
    // having to click on the canvas
    tracker->setStateMachine( new QwtPickerTrackerMachine() );

    tracker->setRubberBandPen( QPen( "MediumOrchid" ) );



Nesne Boyama ve sembl 

    QwtPlot plot;
    plot.setTitle( "Plot Demo" );
    plot.setCanvasBackground( Qt::white );
    plot.setAxisScale( QwtPlot::xBottom, 0.0, 6.0 );// yatay x ekseni degerleri 1-6 arasıdır
    QwtLegend *legend = new QwtLegend();   // kateogoriler tanımlanıyor
    legend->setDefaultItemMode( QwtLegendData::Checkable );  // kategoriler tıklanabilir
    plot.insertLegend( legend );     // kategoriler plota ekleniyor

    
    QwtPlotCurve *curve = new QwtPlotCurve(); // boyama nesnesi olusturuluyor
    curve->setRenderHint( QwtPlotItem::RenderAntialiased, true );
    curve->setPen( Qt::blue );
    QBrush brush;
    QwtSymbol::Style style = QwtSymbol::NoSymbol;
    QString title;
    
    MySymbol *symbol = new MySymbol( style, brush );

    curve->setSymbol( symbol );
    curve->setTitle( title );
    curve->setLegendAttribute( QwtPlotCurve::LegendShowSymbol, true );
    curve->setLegendIconSize( QSize( 15, 18 ) );

    QPolygonF points;
    points << QPointF( 0.0, 1 ) << QPointF( 1, 1 )
        << QPointF( 1, 2 ) << QPointF( 2, 2 )
        << QPointF( 2, 3) << QPointF( 20,20);

   points.translate( 0.0, i * 2.0 );

    curve->setSamples( points );
    curve->attach( &plot );






Share: