Question : QPainterPath

Hi there,
I wrote this code and I get this error, how can I solve it ?

I initialized paint_path like that :
 QPainterPath *paint_path;

this is the error message (no matching function for call to 'QGraphicsPathItem::setPath(QPainterPath*&)')

Thank you
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
void MainWindow::render_electrodes(double (*array)[3])
{
    paint_path = new QPainterPath();
    for(int i=2;i<2000;i++)
    {
        paint_path->lineTo(-(array[i][0]-21831),i);
    }
    path = new QGraphicsPathItem(0,scene);
    path->setPos(140,0);
    path->scale(0.3,1.0);
    path->rotate(-90);
    path->setPen(QPen(Qt::black));
    path->setPath(paint_path);
}

Answer : QPainterPath

I see the api for setPath is:
   void QGraphicsPathItem::setPath ( const QPainterPath & path );
        http://doc.qt.nokia.com/4.6/qgraphicspathitem.html#setPath

But your argument is paint_path, which is (QPainterPath*), I presume, since your code is:
       paint_path = new QPainterPath();

So, dereference paint_path.
Maybe this will work:
     path->setPath( *paint_path);
Random Solutions  
 
programming4us programming4us