[Interest] How to expose a ‘index’ property to a delegate?

Federico Ferri federico.ferri.it at gmail.com
Mon Nov 23 19:17:33 CET 2020


I pushed these files and the QtC project to
https://github.com/fferri/qt3d-thing

On 23 November 2020 at 17:49:17, Federico Ferri (federico.ferri.it at gmail.com)
wrote:

Following your advice, I changed Array.qml to the following: (most notably:
added the repeater.model property alias)

[…]


Cheers,
Federico Ferri

On 23 November 2020 at 16:53:37, Giuseppe D'Angelo via Interest (
interest at qt-project.org) wrote:

Il 23/11/20 14:20, Federico Ferri ha scritto:
>
> but of course in this example it is using a non-existent ‘index’ in the
> PhongMaterial.diffuse binding.

Are you sure it's non-existing? The context in which that delegate is
going to be created should have "index" injected into it.

Needless to say, all of this is deprecated in 5.15 (in favour of
required properties), and even before you were never supposed to use
unqualified properties like those. You were supposed to

1) always prefix them with model.
2) expose properties on the root of the delegate, use them internally as
needed, and bind them when using the delegate in a view.

See > https://youtu.be/vzs5VPTf4QQ?t=2240

HTH,

-- 
Giuseppe D'Angelo | giuseppe.dangelo at kdab.com | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - The Qt, C++ and OpenGL Experts

_______________________________________________
Interest mailing list
Interest at qt-project.org
https://lists.qt-project.org/listinfo/interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20201123/8d6a2659/attachment.html>


More information about the Interest mailing list