Hello all,

new to this form, and getting started with Qt/Quick. I am currently trying to factor out generic parts of our UI code into a plugin which would then provide new UI components usable in multiple projects. I chose the plugin path (over QML module), because deployment is a *little* less complicated (why in the world do I need to maintain the qmldir file? Why can't the plugin shared lib provide all info when loaded?), and since the code is fairly dynamic I prefer the typed environment of a C++ implementation over Javascript. However, I did not want to lose the advantages of the dedicated QML syntax. I therefore decided to include QML files as resources inside the plugin lib, load the components at runtime and create and parameterize items as required. In particular, I have a navigation panel which can show an arbitrary number of navigation tiles which will navigate to a configurable target.

Now, here comes issue 1: I am able to load the QML component inside the componentComplete() method of my contributed type (call it NavigationPanel). I then try to find the GridLayout which is defined inside the resource file by id (findChild<QQuickItem *>(name)) - which fails.

issue 2: I then try to get at the GridLayout using childItems().at(2), assuming that is the right one (theres only 2 nested items). I then go on to find nested NavigationTile objects (another contributed type) and use them to parameterize items created from another loaded QML component, and add the items to the GridLayout. When I start the application, nothing displays

Heres my questions: is my approach even feasible? Why am I not able to retrieve the GridLayout child by id? What do I need to do to make everything display correctly? Do I need to implement updatePaintNode (and set QQuickItem::ItemHasContents), and if so, how?

heres an example of the app code that uses my contributed types:

Qt Code:
  1. Rectangle {
  2. NavigationPanel {
  3. NavigationTile {
  4. target: "nextpage1.qml"
  5. }
  6. NavigationTile {
  7. target: "nextpage2.qml"
  8. }
  9. }
  10. }
To copy to clipboard, switch view to plain text mode 

and heres the QML that gets loaded from within the NavigationPanel implementation:

Qt Code:
  1. Rectangle {
  2. Rectangle {
  3. GridLayout {
  4. id: tilesGrid
  5. }
  6. }
  7. }
To copy to clipboard, switch view to plain text mode 

I hope this makes sense to someone out there

thanks,
Christian