RowLayout in a Flickable containing 2 ColumnLayouts - how to snap to appropriate ColumnLayout
-
A VERY SIMPLE example (template) of what is implemented. Hopefully sufficient, as it has minimal correlation to the question.
Flickable
{
flickableDirection: Flickable.AutoFlickIfNeeded | Flickable.HorizontalFlick
onFlickEnded:
{
// What should go here to snap the content visible to the origin of the appropriate
// ColumnLayout where the center of the content now resides?
// mapTo()? childAt()? contains()?
}
RowLayout
{
ColumnLayout
{
id: firstColumnLayout// Buttons, text, other controls, whatever the user wants to fill this with given the confines // of the device screen dimensions +/- header and footer stuff. } ColumnLayout { id: secondColumnLayout // Buttons, text, other controls, whatever the user wants to fill this with given the confines // of the device screen dimensions +/- header and footer stuff. } }
}
The row and its columns scroll left and right, as desired, but we want to snap to the appropriate column. The Item documentation talks about contains() as a possible test, but it talks about "local" coordinates for the x/y passed to it without explaining the context as to what constitutes "local".
I know this is done, but not clear with respect to the methods provided which are used in conjunction with what. These are layouts, collections of assorted items. What item is associated with the x/y point is not what is important. Is there a childOf method that would tell whether the returned item from childAt is in the family tree of the layout? Can it be done without naming the layouts?
Thanks.