Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Solved QPointer, QSharedPointer and QWeakPointer - When it's perfect solution when it's not?

    General and Desktop
    2
    3
    77
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B
      bogong last edited by bogong

      Hello!
      Just got curious about situation when using of QPointer, QSharedPointer or QWeakPointer is perfect solution and when it's not. Suggestions?

      1 Reply Last reply Reply Quote 0
      • Chris Kawa
        Chris Kawa Moderators last edited by

        QPointer when you want to observe QObject's lifetime.
        QSharedPointer when you share ownership of an object (last owner deletes the object)
        QWeakPointer when you want to observe lifetime of an object owned by shared pointers.

        B 1 Reply Last reply Reply Quote 4
        • B
          bogong @Chris Kawa last edited by bogong

          @Chris-Kawa Thx. Looks very similar to Objective-C pointers ... Issue closed.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post