samedi 5 septembre 2020

QVariantList of QGADGET items possible?

I want to convert a std::vector into a QVariantList to use in my QML page.

Seems something go wrong with my implementation :

Q_INVOKABLE QVariantList scores() {
  QVariantList vl;
  for(const auto& item : liveScores->GetMatchesOfTheDay())
    vl.push_back(QVariant(item));
  return vl;
}

The result of the liveScores->GetMatchesOfTheDay() is a :

std::vector<Match>

The class Match is NOT derived from a QOBJECT. But the macro Q_GADGET is present

Thank you

Aucun commentaire:

Enregistrer un commentaire