Results 1 to 10 of 10

Thread: QList with pointers

Hybrid View

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

    Default Re: QList with pointers

    n will be deleted but its copy that is in the list will get copied again and returned as part of the list. That's why you need to implement the copy constructor for your class. And if you make Number an implicitly shared class, only the facade part of the object will be allocated on the stack and the real data will reside on heap and will not be copied whenever the object itself is copied.
    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. #2
    Join Date
    Feb 2008
    Posts
    28
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QList with pointers

    how do I make a class to be implicitly shared class ?

    thanx

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QList with pointers

    Open Qt Assistant and type in "Implicitly Shared Classes" in the index tab. Then type in "QSharedDataPointer".
    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.


Similar Threads

  1. Sorting using qSort(), - if QList contains POINTERS
    By joseph in forum Qt Programming
    Replies: 13
    Last Post: 18th August 2013, 18:55
  2. QList, copy problems
    By Valheru in forum Qt Programming
    Replies: 4
    Last Post: 5th February 2010, 00:06
  3. QList Pointers
    By coderbob in forum Newbie
    Replies: 2
    Last Post: 20th November 2007, 18:50
  4. Accessing QList Objects
    By magikalpnoi in forum Qt Programming
    Replies: 7
    Last Post: 21st September 2006, 20:43
  5. QList of pointers
    By Farcaller in forum Newbie
    Replies: 4
    Last Post: 24th January 2006, 16:48

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.