[Interest] Qml/qmlllint: coercion / typecasts possible?

Heiko Gerdau hg at technosis.de
Mon Aug 21 18:09:02 CEST 2023


Hi,

Am 21.08.23 um 16:49 schrieb Nils Jeisecke via Interest:
>             clickedItem = layout.childAt(mouse.x, mouse.y);
>              if (clickedItem) {
>                  const index = clickedItem.index;
>                  console.log("clicked", clickedItem, "index", index)
>              }

  you could use

  const index = (clickedItem as Foo).index;

Unfortunately there is BUG#116264 which prevents inline components to be 
used that way but hopefully will be fixed in one of the next Qt-Versions.

It would work if you put the Foo component into a Foo.qml file.

Regards,
Heiko


More information about the Interest mailing list