diff -r 5dc02b23752f -r 3e2da88830cd examples/declarative/ui-components/tabwidget/TabWidget.qml --- a/examples/declarative/ui-components/tabwidget/TabWidget.qml Tue Jul 06 15:10:48 2010 +0300 +++ b/examples/declarative/ui-components/tabwidget/TabWidget.qml Wed Aug 18 10:37:55 2010 +0300 @@ -43,22 +43,28 @@ Item { id: tabWidget + // Setting the default property to stack.children means any child items + // of the TabWidget are actually added to the 'stack' item's children. + // See the "Extending Types from QML" documentation for details on default + // properties. + default property alias content: stack.children + property int current: 0 - default property alias content: stack.children onCurrentChanged: setOpacities() Component.onCompleted: setOpacities() - function setOpacities() - { + function setOpacities() { for (var i = 0; i < stack.children.length; ++i) { - stack.children[i].opacity = i == current ? 1 : 0 + stack.children[i].opacity = (i == current ? 1 : 0) } } Row { id: header + Repeater { + model: stack.children.length delegate: Rectangle { width: tabWidget.width / stack.children.length; height: 36 @@ -85,7 +91,6 @@ onClicked: tabWidget.current = index } } - model: stack.children.length } }