[Development] Adding std::weak_ptr<void> to QModelIndex

Filippo Cucchetto filippocucchetto at gmail.com
Fri Apr 21 09:32:44 CEST 2017


2017-04-21 9:13 GMT+02:00 Marc Mutz <marc.mutz at kdab.com>:

> On Friday 21 April 2017 08:42:37 Filippo Cucchetto wrote:
> > Is there any plan to enhance the QModelIndex interface by adding support
> to
> > std::weak_ptr<void?
> > I know that is not necessary since we can directly store T* from
> > shared_ptr<T> but being able to store a weak_ptr seems a little bit
> safer.
>
> There is no such plan. QModelIndexes should not be stored anywhere, they
> are
> simply an interface type: as long as you're using ti correctly, you could
> not
> observe the weak_ptr being reset
>
> Yes and i agree, but there's a difference between a crash of an
application and a warning.
Futhermore since QModelIndexes have been somewhat interfaced with QML this
bring
a lot of indeterminism.


> If and when we change QModelIndex to become more convenient, but also more
> expensive to use, it should probably get a QVariant (or std::any), not any
> particular type.
>
> Thanks,
> Marc
>
> --
> Marc Mutz <marc.mutz at kdab.com> | Senior Software Engineer
> KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
> Tel: +49-30-521325470
> KDAB - The Qt, C++ and OpenGL Experts
>



-- 
Filippo Cucchetto
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20170421/7c4922b6/attachment.html>


More information about the Development mailing list