Important: Please read the Qt Code of Conduct -

Polymorphic item with QExplicitlySharedDataPointer

  • 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

  • I don't see problem with clone (or I don't understand the point of your question :( ). See "QSharedDataPointer::clone() doc": for clues. However, it means that you have to pollute your interface with clone method.

  • QSharedPointer did exactly what i needed

Log in to reply