Hi,

I´m wondering whether or not 'variant' is the correct type used for 
arrays in QML. Before going into longish explanations I´ll give some 
striped-down example code.

// Slide.qml
Item {
     property string title
}

// SlideShow.qml
Item {
     property string title
     property variant slides
}

// ExampleSlideShow.qml
SlideShow {
     title: "My first slide show"
     slides: [
         Slide { title: "My first picture" },
         Slide { title: "My second picture" }
     ]
}

// main.qml
Rectangle {
     property variant slideShowData: ExampleSlideShow{}

     width: 400
     height: 200

     Text {
         id: title
         text: "Slide Show Title: " + slideShowData.title
     }
     Text {
         text: "Slide Title: " + slideShowData.slides[0].title //<<<
         anchors.top: title.bottom
     }
}

The statement "slideShowData.slides[0].title" is not working. because 
"slideShowData.slides[0]" is always undefined.

If I debug the code, I see that "slideShowData.slides" actually points 
to the last added 'Slide' component. So it´s not even an array.

Can someone explain to me why it is like this and what the correct way 
of solving this issue would be?

Thank you very much!
Conny
_______________________________________________
Qt-qml mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-qml

Reply via email to