05-10-2012 09:54 AM
Hi, I would like to have a horizontal list but cannot figure out how using the cascades libraries. I can see how it is done using the regular QT libraries, there is an orientation property but this does not exist in the Cascades ListView.
Does anyone know of a way to do this using Cascades?
Solved! Go to Solution.
05-10-2012 11:02 AM
I'm pretty sure that a StackLayout can be modified to be horizontal. I'm not 100% on that, but I seem to recall that from one of the Jam sessions.
05-10-2012 11:09 AM
Looks like you should be able to set the layout to a StackListLayout created with its layoutDirection set to LayoutDirection::LeftToRight.
I'd guess at a code sample, but I'm just getting to grips with translating what I see in the docs into QML syntax, and anyway you didn't say whether you're doing QML or C++.
05-10-2012 11:21 AM
StackLayout is a QML property of Container , so you can easily arrange items like text boxes or images horizontally in a Container using:
layout: StackLayout {
layoutDirection: StackLayout.LeftToRight
}
But it does not work in a ListView because ListView does not have this property.
05-10-2012 11:25 AM
05-10-2012 11:28 AM
05-10-2012 11:30 AM
05-10-2012 11:43 AM
05-10-2012 12:47 PM - edited 05-10-2012 12:48 PM
Ok it can be done in C++:
Using the CookBook example program I declared a new StackListLayout variable in ListView *CascadesCookbookApp::createRecipeListView() and passed it into ListView:
StackListLayout *sll = new StackListLayout(LayoutDirection::LeftToRight);
ListView *recipeListView = new ListView(sll);
I would still prefer having a solution within QML but at least I know it can be done.
05-11-2012 10:29 AM
The way of doing this in QML is coming but is currently not supported. For now you could handle most UI in QML and just set the layout using C++ if needed to help keep things clean until the QML functionality is there.