N
N
NosferatuZodd2021-12-14 16:05:40
Qt
NosferatuZodd, 2021-12-14 16:05:40

Why doesn't QPainterPath draw?

I draw a graph using QPainterPath, I have already climbed all the forums and still do not understand why it does not draw, the code is:

QPainterPath path;

    path.moveTo((width()/2)-100*scale, (height()/2)-chart->func(-100)*scale);


    float y = 0;
    for(float x = -100; x <= 100; x+=0.001) {
        y = chart->func(x);
        path.lineTo(((width()/2)+x *scale), ((height()/2)-y*scale));

    }
    path.closeSubpath();
    painter.drawPath(path);

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question