• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 963
  • Last Modified:

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
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);
}

Open in new window

0
obad62
Asked:
obad62
1 Solution
 
phoffricCommented:
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);
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now