> On 10 May 2025, at 11:37, Giuseppe D'Angelo via Development 
> <development@qt-project.org> wrote:
> 
> Il 09/05/25 17:26, Edward Welbourne ha scritto:
>>> The only issue I have is with the name.
>> QRangeAdaptorItemModel ?
>> Just reading your words back at you ...
> 
> Well, maybe the authors of the class wanted to defend their naming choice. :-)
> 
> QRangeAdaptorItemModel or QRangeBasedItemModel work for me.


Would a simple

QRangeItemModel

be clear enough? The “Based” doesn’t seem to add a lot of clarity.

Also, as discussed at Qt CS (and mentioned in the last point of the notes at 
https://wiki.qt.io/QtCS25_-_QGenericItemModel):

I would like to come up with some C++ template class that gives type-safe 
access to the model while also respecting QAIM requirements, but doesn’t 
require any usage of QModelIndex, role values etc. I suspect that “Adaptor” 
will be a good term to use for such a class. Something along the lines of:


std::vector<int> data;
QRangeItemModelAdaptor adaptor(data);
view.setModel(adaptor.model());

…

adaptor.erase(adaptor.begin());
adaptor[0] = x;
adaptor.push_back(y);


and in a tree and using C++23:

adaptor[0, 3] = {…}; // sets the third child of the first root item


The adaptor makes sure that “model” emits the signals etc required to keep 
views and persistent model indices up to date. We won’t be able to do that on 
the C++ side without building some wrapper around ‘data’ that client code has 
to use.


Volker

-- 
Development mailing list
Development@qt-project.org
https://lists.qt-project.org/listinfo/development

Reply via email to