[Qt-qml] Parenting with Flickable
gabriel.dietrich-de at nokia.com
gabriel.dietrich-de at nokia.com
Wed Sep 1 19:44:08 CEST 2010
Hi all,
I’m currently implementing a position indicator (kind of scrollbar) for the Qt Components project. My first shot, adding it to a ListView as a child worked quite well. Basically, it looks like this:
ListView {
model: ...
delegate: ...
PositionIndicator { } <---- Yes, its body is empty
}
Inside the PositionIndicator component I’m setting an alias property as the parent of the Item, and using its “visibleArea.*” properties. So far, so good.
Then I tried with Flickable, like this:
Flickable {
contentWidth: ...
contentHeight: ...
Rectangle { ... }
PositionIndicator { }
}
and I get an error about “visibleArea” not being defined. So I decided to set the PositionIndicator as a sibling of the Flickable with a property referencing it:
Flickable {
id: rectFLick
contentWidth: ...
contentHeight: ...
Rectangle { ... }
}
PositionIndicator {
flickable: rectFLick
}
and it works again. Now the questions are,
1. What makes the difference between the parenting in ListView and Flickable, and why?
2. Which syntax should I “prefer” between both? (Even though the first syntax doesn’t work with Flickable, we may end up creating a list view and a flickable components for Qt Components, hence the question).
Thanks in advance.
Best regards,
Gabriel de Dietrich
Software Engineer
http://qt.nokia.com
More information about the Qt-qml
mailing list