Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Polymorphic item with QExplicitlySharedDataPointer
QtWS25 Last Chance

Polymorphic item with QExplicitlySharedDataPointer

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 977 Views
  • 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.
  • S Offline
    S Offline
    SavageTwinky
    wrote on last edited by
    #1

    I'm trying to use use QExplicitlySharedData pointer with an abstract interface. Clone makes it slightly difficult because the interface is abstract.

    basically I'm thinking all i need to do is reimplement clone but I'm not sure how to get it to create the correct object. Thanks.

    I'm just trying to see if i can use it as a simple containter for dependency injection, if the pointer is ever deleted it just makes it slightly safer for the objects that depend on it. So if Qt has something better that would be awesome.

    err maybe i need QSharedPointer, i should really stop working at 4:am the stupid is showing

    1 Reply Last reply
    0
    • B Offline
      B Offline
      bodzio131
      wrote on last edited by
      #2

      I don't see problem with clone (or I don't understand the point of your question :( ). See "QSharedDataPointer::clone() doc":http://qt-project.org/doc/qt-4.8/qshareddatapointer.html#clone for clues. However, it means that you have to pollute your interface with clone method.

      1 Reply Last reply
      0
      • S Offline
        S Offline
        SavageTwinky
        wrote on last edited by
        #3

        QSharedPointer did exactly what i needed

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved