Results 1 to 6 of 6

Thread: QGraphicsItem: pure virtual method call problem

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    Join Date
    Jan 2012
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QGraphicsItem: pure virtual method call problem

    Quote Originally Posted by ChrisW67 View Post
    Are you calling virtual methods in the constructors or destructor of the TrackObject class?

    Edit: beaten to it.
    I sure that i did not call any virtual methods in my constructors or destructors.

    here is my constructor, i only initialized some properties:
    Qt Code:
    1. TrackObject::TrackObject(QgsMapCanvas* canvas) : QgsMapCanvasItem(canvas)
    2. {
    3. mSize = 16;
    4. trackInfo = NULL;
    5. heading = 0;
    6. speed = 0;
    7. fColor = QColor(0, 0, 0);
    8. mLastReceiveTime = time(NULL);
    9. bActive = false;
    10. bDrawHeading = true;
    11. nOnwFligh = 0;
    12. textPosition = 0;
    13. nBateryId = 0;
    14. targetStatus = FilterUnknown;
    15. nTrackID = -1;
    16. nTrackNumber = -1;
    17. isDisplaying = true;
    18. setFlag(ItemIsMovable);
    19. }
    To copy to clipboard, switch view to plain text mode 
    and the destructor, just delete the trackinfo object. the TrackInfo object store some information about the coordinate (lontitude, latitude,..) and also not call any virtual function in its destructor:
    Qt Code:
    1. TrackObject::~TrackObject()
    2. {
    3. if(trackInfo)
    4. {
    5. delete trackInfo;
    6. trackInfo = NULL;
    7. }
    8. }
    To copy to clipboard, switch view to plain text mode 
    the application not crashed immediately when started but it only run within about 15 - 30 mins after some create and delete TrackObject times.
    Last edited by phuongot; 17th January 2012 at 07:30.

Similar Threads

  1. Replies: 2
    Last Post: 26th November 2011, 04:52
  2. the pure virtual method "abort" in QNetworkReply
    By mavenlin in forum Qt Programming
    Replies: 2
    Last Post: 9th July 2011, 10:01
  3. Replies: 16
    Last Post: 13th March 2008, 17:46
  4. Cost of pure virtual
    By ShaChris23 in forum General Programming
    Replies: 4
    Last Post: 4th November 2007, 18:20
  5. inheritance, pure virtual
    By TheKedge in forum General Programming
    Replies: 2
    Last Post: 18th January 2007, 11:20

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.