QtCS25 - QGenericItemModel: Difference between revisions
Jump to navigation
Jump to search
(Created page with "==Session Summary== ''Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum.'' ==Session Owners== ''Lorem Ipsum'' ''Consetetur Sadipscing'' ==Notes== ''Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At v...") |
Ivan.solovev (talk | contribs) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
==Session Summary== | ==Session Summary== | ||
General solution to expose C++ data to QtQuick. | |||
Based on QAbstractItemModel, uses a templated constructor taking a Range by a universal ref (see docs) | |||
==Session Owners== | ==Session Owners== | ||
Presenter: Volker | |||
Notes: Ivan | |||
==Notes== | ==Notes== | ||
Some live examples: | |||
* Passing data by const & non-const values, references or ptrs. | |||
** Q: Should we forbid passing by value? | |||
** Passing const data by value -> data in the model is still const, even though it's copied internally. Confusing for C++ developers. | |||
* Using different input types | |||
** vector | |||
** Json array | |||
** list of tuples -> representing multi-column data | |||
** QMetaEnumerator | |||
** actual C++20 ranges | |||
* Unbounded ranges | |||
** Q: How to handle that nicely? Do we need fetchMore() for that? | |||
* QList<QList<Gadget>> -> table. | |||
* MultiColumn vs SingleColumn: | |||
** vector of ptrs to MultiColumn -> table | |||
** vector of ptrs to SingleColumn -> list | |||
More questions: | |||
* What if we store pointers? Who takes the ownership when we create an instance from QML? | |||
** That's the why we need second c-tor that takes the Protocol type - see docs for more details. | |||
* How to modify the data that we handled to the model (by ref or ptr) without using the QAIM API? | |||
** Various approaches are possible - TBD. | |||
[[Category:QtCS2025]] |
Latest revision as of 14:58, 8 May 2025
Session Summary
General solution to expose C++ data to QtQuick.
Based on QAbstractItemModel, uses a templated constructor taking a Range by a universal ref (see docs)
Session Owners
Presenter: Volker
Notes: Ivan
Notes
Some live examples:
- Passing data by const & non-const values, references or ptrs.
- Q: Should we forbid passing by value?
- Passing const data by value -> data in the model is still const, even though it's copied internally. Confusing for C++ developers.
- Using different input types
- vector
- Json array
- list of tuples -> representing multi-column data
- QMetaEnumerator
- actual C++20 ranges
- Unbounded ranges
- Q: How to handle that nicely? Do we need fetchMore() for that?
- QList<QList<Gadget>> -> table.
- MultiColumn vs SingleColumn:
- vector of ptrs to MultiColumn -> table
- vector of ptrs to SingleColumn -> list
More questions:
- What if we store pointers? Who takes the ownership when we create an instance from QML?
- That's the why we need second c-tor that takes the Protocol type - see docs for more details.
- How to modify the data that we handled to the model (by ref or ptr) without using the QAIM API?
- Various approaches are possible - TBD.