[Development] Would it make sense to make QObject moveable in Qt 6?

Sune Vuorela nospam at vuorela.dk
Thu Aug 25 09:28:16 CEST 2016


On 2016-08-24, Thiago Macieira <thiago.macieira at intel.com> wrote:
> And its address is copyable, so if we replaced the pointer with something, 
> we'd have to use something copyable and non-owning.

class QObjectHandle {
    public:
       QObjectHandle(QObject* obj) : m_obj(obj) { }
       operator QObject* () const ( return m_obj.data() }
       bool operator==(const QObjectHandle& other) const { return m_obj ==
       other.m_obj;}
       // default created rest of it is fine
    private:
       QPointer m_obj;
}

There. made it. Unsure what it gains us.

/Sune




More information about the Development mailing list