[Development] Qt 5 types under consideration for deprecation / removal in Qt 6

Konstantin Tokarev annulen at yandex.ru
Wed May 29 15:16:37 CEST 2019



29.05.2019, 15:49, "drwho" <drwho at infidigm.net>:
> On 2019-05-29 6:53 a.m., Mutz, Marc via Development wrote:
>>  == QSharedPointer / QWeakPointer -> std::shared_ptr/weak_ptr ==
>>
>>  Once they are stripped of their magic QObject handling and QObject
>>  handling returned to QPointer proper, they don't do much other than
>>  std::shared_ptr, except being less flexible and largely untested for
>>  exception-safety.
>
> so QEnableSharedFromThis::sharedFromThis() would return a std::shared_ptr?

You should use std::enable_shared_from_this instead.

>
> class Device : public QObject, public QEnableSharedFromThis<Device>
> {
>      Q_OBJECT
> public:
>      Device();
>
> signals:
>      void update(QSharedPointer<Device> device);
>
> };
>
> in some method in Device....
>
> emit update(sharedFromThis());
>
> Jon
>
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> https://lists.qt-project.org/listinfo/development

-- 
Regards,
Konstantin



More information about the Development mailing list