[Development] QAbstractItemModel::createIndex(void const*)?

Konstantin Shegunov kshegunov at gmail.com
Tue Nov 27 23:55:05 CET 2018


On Tue, Nov 27, 2018 at 9:59 PM Matthew Woehlke <mwoehlke.floss at gmail.com>
wrote:

> Right. Mostly. Note that in my original example, I was supplying a
> pointer to a member of my model.


This seems like an odd thing to do. How I usually operate is to have the
model as proxy for the actual data storage.


> Because index() is const, when I take
> that address, I get a const pointer, even though the member itself isn't
> const (and it would be okay for me to cast it to non-const when using it
> in a non-const member).
>
> It sounds like Jean-Michaƫl ran into the exact same problem.
>

True. I wonder why I haven't hit such a case, or maybe I have but just have
forgotten about it ...

The point is, the pointer is going to be coerced into a quintptr anyway,
> so there is no particular reason why we *shouldn't* accept a const
> pointer as the data... not having that overload just forces the user to
> explicitly recast the pointer themselves.
>

Indeed. Sounds reasonable, to me at least, to add an overload.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20181128/473921f2/attachment.html>


More information about the Development mailing list