> On 12 May 2025, at 10:41, Giuseppe D'Angelo <giuseppe.dang...@kdab.com> wrote:
> 
> On 12/05/2025 09:53, Volker Hilsheimer wrote:
>> Would a simple
>> QRangeItemModel
>> be clear enough? The “Based” doesn’t seem to add a lot of clarity.
> 
> It does what it says, though. But before discussing this further...
> 
> 
>> Also, as discussed at Qt CS (and mentioned in the last point of the notes 
>> athttps://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:
> 
> ... this is a more important issue. Is the above planned for 
> QGenericItemModel itself, or would that be feature creep/out-of-scope and 
> should be done by another class? If yes, what would QGIM role be if this 
> other class gets also introduced?


The same approach is in the back of my head for QGIM, so that’s not dependent 
on the name. I suspect that we’ll end up with a “Q*ItemModel” and 
“Q*ItemModelAdaptor” (or “Q*ItemModel::Adaptor”) pair of classes. Not happening 
for 6.10, and we’ll need to see what we end up with for other languages as part 
of the Qt Bridges work we announced at Qt World Summit. Maybe the work on the 
rust side (where we also cannot hook into some runtime) is going to give us 
some solution.

An adaptor type instance can instantiate the item model type, but not the other 
way around. So perhaps ultimately you’d do:

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


(if you want to fiddle with `data` from C++ after handing it over to the 
model/view or QML).

Volker

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

Reply via email to