0

I am facing a same problem as that of fellow user,given is the link for the query similar to mine-

Qt QML C++ QList of structs as custom ListView model

but i want to stick with struct instead of class with QProperty having the members as that of struct and access these struct members in my qml. How can i do this?

4
  • You'll most likely have to wrap your structs in a QObject. Why not use a class directly? Commented Mar 3, 2017 at 11:11
  • I'd wrap the whole array if structs into a QAbstractListModel. It's a bit more work however. Commented Mar 3, 2017 at 11:59
  • The answer is already accepted in the link. "QML cannot access low-level struct types. " Commented Mar 3, 2017 at 12:36
  • class or struct doesn't really make a difference in C++ other than default access modifier. Can you provide some information on what you want to do with your data? How do you want to use the objects and or their data in QML? Commented Mar 4, 2017 at 9:42

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.