C++: how to call QML ListView selected item object?
My QML file has a listview which use VisualItemModel to display each item (each item is a qml page). In my C++, how to get the selected object? In another word, how to get the selected item in C++?
My list model:
- VisualItemModel {
- property int itemwidth: 0
- property int itemheight: 0
- page1 {
- id: p1
- width: itemwidth
- height: itemheight
- }
- page2 {
- id: 2
- width: itemwidth
- height: itemheight
- }
- page3 {
- id: p3
- width: itemwidth
- height: itemheight
- }
- }
In the C++ code:
If I selected p1, then how to get p1 object? The page1 / page2 / page3 are 3 qml files in the same directory.
1 reply
You must log in to post a reply. Not a member yet? Register here!

