Results 1 to 4 of 4

Thread: subclassing QGraphicsItem, QGraphicsPixmapItem

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: subclassing QGraphicsItem, QGraphicsPixmapItem

    It won't work that way. The method returns a QGraphicsPixmapItem so you can only assign it to QGraphicsPixmapItem or its ancesstor (QGraphicsItem) pointer.

    If you want to subclass QGraphicsItem or one of its subclasses, you need to add the item to the scene in a different manner:
    Qt Code:
    1. myGraphicsItem *item = new myGraphicsItem;
    2. scene()->addItem(item);
    To copy to clipboard, switch view to plain text mode 
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  2. The following user says thank you to wysota for this useful post:

    rogerholmes (26th August 2009)

Similar Threads

  1. Replies: 2
    Last Post: 25th March 2011, 09:18
  2. destruction of QGraphicsItem
    By killkolor in forum Qt Programming
    Replies: 2
    Last Post: 5th December 2009, 10:31
  3. Replies: 1
    Last Post: 25th February 2009, 00:34
  4. QGraphicsItem Subclassing
    By QbelcorT in forum Newbie
    Replies: 4
    Last Post: 19th November 2008, 01:06
  5. Multiple Inheritance for QGraphicsItem
    By pankaj.patil in forum Qt Programming
    Replies: 2
    Last Post: 1st July 2008, 14:49

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
  •  
Qt is a trademark of The Qt Company.