December 30, 2011

kappa kappa
Lab Rat
12 posts

Dynamic PropertyGrid with QML and C++

 

Hello.
I have something like PropertyGrid defined in QML (using GridView element).
I can add my elements (PGRow, which is a row with two rectangles with labels). I’m doing it using ListModel:

  1.     GridView {
  2.         [...]
  3.         delegate: rowDelegate
  4.         model: pgModel
  5.     }
  6.  
  7.     ListModel{
  8.         id: pgModel
  9.         objectName: "pgModel"
  10.         ListElement{
  11.             caption: "Property 1"
  12.             value: "12345"
  13.         }
  14.     }
  15.     Component{
  16.         id: rowDelegate
  17.         PGRow{
  18.             caption: model.caption
  19.             value: model.value
  20.         }
  21.     }

My problem is: I want to add rows dynamically using C++. How should I do it?
I’ve read this: Using QML Bindings in C++ Applications [doc.qt.nokia.com] but still have no idea how to get to the pgModel elements from C++.

0 replies

 
  ‹‹ QtScript and XML      Run Qt Jambi From Eclipse ››

You must log in to post a reply. Not a member yet? Register here!