I want to expose a QVariantList
from C++ to QML. The QVariantList
can contain data of types Integer
, QString
and QStringList
. I want to use it as a model for a QML ListView
and also I want to use a different Delegate
for the elements depending on the type in the QVariantList
. So data of type Integer
are displayed differently than data of type String
and StringList
.
- How can I detect the type of the elements in the
QVariantList
in QML? - How can I use a different
delegate
depending on the type?
I need a solution where I can change the exposed QVariantList
and the ListView and its delegates will change.