Solved

QPainterPath

Posted on 2010-08-27
1
944 Views
Last Modified: 2013-11-23
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
Comment
Question by:obad62
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 32

Accepted Solution

by:
phoffric earned 500 total points
ID: 33540214
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

Industry Leaders: 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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question