Results 1 to 2 of 2

Thread: Creating a list of QGraphicsItems

  1. #1
    Join Date
    Jul 2011
    Posts
    16
    Qt products
    Qt4
    Platforms
    Windows

    Default Creating a list of QGraphicsItems

    Hi,

    I have a QGraphicsScene on which I would like to draw some special curves. I made a class in which I define these special curves as a new QGraphicsItem:

    Qt Code:
    1. class Clothoid : public QGraphicsItem
    2. {
    3. public:
    4. Clothoid(QPoint startPoint, QPoint endPoint);
    5. virtual ~Clothoid();
    6. ...
    7.  
    8. protected:
    9. QRectF boundingRect() const;
    10. void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
    11.  
    12. };
    To copy to clipboard, switch view to plain text mode 

    and I try to insert each item twice: once in an array I defined:

    Qt Code:
    1. QList<Clothoid *> clothoids;
    To copy to clipboard, switch view to plain text mode 

    and once in the scene:

    Qt Code:
    1. void renderArea::updateClothoid(const QPoint &p1, const QPoint &p2)
    2. {
    3. Clothoid *temp = new Clothoid(p1, p2);
    4.  
    5. clothoids.append(&temp);
    6.  
    7. scene->addItem(&temp);
    8. }
    To copy to clipboard, switch view to plain text mode 

    But I get these 2 errors:

    no matching function for call to 'QList<Clothoid*>::append(Clothoid**)'

    and

    no matching function for call to 'QGraphicsScene::addItem(Clothoid**)'

    What am I doing wrong?

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Creating a list of QGraphicsItems

    Skip the &. And by the way the error message is telling you all you need to know...

Similar Threads

  1. Creating list with images and widgets laid out
    By marcvanriet in forum Newbie
    Replies: 1
    Last Post: 17th November 2010, 04:33
  2. Help me on creating a List Widget...
    By Bong.Da.City in forum Newbie
    Replies: 50
    Last Post: 11th September 2010, 14:51
  3. A list of QGraphicsItems
    By Bill in forum Newbie
    Replies: 3
    Last Post: 22nd July 2009, 11:57
  4. how to get a list of QGraphicsItems with no parent?
    By mooreaa in forum Qt Programming
    Replies: 6
    Last Post: 30th July 2008, 10:36
  5. How to make a list of QGraphicsItems on the scene
    By Holy in forum Qt Programming
    Replies: 8
    Last Post: 10th June 2008, 13:43

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.