On 02/02/2020 18:17, Иван Комиссаров wrote:
No one answered my question about QObject::deleteLater:And what about the QObject::deleteLater() method? Any ideas how this should look like with smart pointers?
You can specify custom deleters for smart pointers. For QScopedPointer there's already a convenience class that does it:
QScopedPointer<MyObject, QScopedPointerDeleteLater> ptr = ~~~; // ptr falls out of scope, deleteLater() is called on the pointee
Such a convenience deleter should be moved to QObject, to be honest (and no, it's not usable as-is with std:: smart pointers).
Note: I didn't review Daniel's proposal so I'm not sure if this would actually work in there.
HTH, -- Giuseppe D'Angelo | giuseppe.dang...@kdab.com | Senior Software Engineer KDAB (France) S.A.S., a KDAB Group company Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com KDAB - The Qt, C++ and OpenGL Experts
smime.p7s
Description: S/MIME Cryptographic Signature
_______________________________________________ Development mailing list Development@qt-project.org https://lists.qt-project.org/listinfo/development