[Development] Programmable delegate selection for QML views

Mitch Curtis mitch.curtis at qt.io
Mon Aug 6 17:03:35 CEST 2018


> -----Original Message-----
> From: gr3cko at gmail.com <gr3cko at gmail.com> On Behalf Of Pierre-Yves
> Siret
> Sent: Monday, 6 August 2018 3:34 PM
> To: Mitch Curtis <mitch.curtis at qt.io>
> Cc: Paolo Angelelli <paolo.angelelli at qt.io>; development at qt-project.org
> Subject: Re: [Development] Programmable delegate selection for QML views
> 
> > One minor problem with this is what we do when none of the delegates
> match the data type. #1 seems to cover this (https://codereview.qt-
> project.org/#/c/206670/8/src/qml/types/qqmldelegatemodel.cpp
> <https://codereview.qt-
> project.org/#/c/206670/8/src/qml/types/qqmldelegatemodel.cpp> ) by
> requiring that delegate also be implemented if a delegateChooser is
> provided. How does #2 account for it? I guess with #2 there should be a way
> to provide a "default" delegate, by e.g. leaving all properties (indexValue,
> roleValue) unset so that it acts a sort of wildcard?
> 
> 
> A default delegate looks like the sensible way to go indeed.
> But should we REQUIRE one ? Why can't we just not instantiate something
> when no fitting delegate is found ? That's what I believe #1 is actually doing.

It's an interesting question. :D Personally I don't see the point. The behaviour for views has always been that there will always be a delegate available when it is needed. How would "missing" delegates work? I would imagine that would mess up something, somewhere internally in Qt Quick view classes.

Or to ask it a different way: why do you have data in your model if it shouldn't be displayed?


More information about the Development mailing list