[Qt-qml] Is there a way to randomize the display of items in views
Gregory Schlomoff
gregory.schlomoff at gmail.com
Thu Jul 22 11:39:01 CEST 2010
There is a Math.random() function under javascript. One solution would be to
use it with ListModel.move() to shuffle the ListModel after it has been
created.
Another solution would be to have the data come from a C++ model, like a
QList<QObject*>, and to the shuffling from C++.
On Thu, Jul 22, 2010 at 4:24 PM, Shady Zayat <shady at zoogylabs.com> wrote:
> I am using a Row and a Repeater to display data from a ListModel. Is there
> a way to randomize the order of the displayed elements? I'm implementing
> radio group behavior for multiple-choice questions for a learning
> application ( "Choice" is a kind of a radio button ). I need the choices to
> be displayed in a random order.
>
> Row {
>
> id: choicesRow
>
> spacing: 10
>
> Repeater {
>
> model: elementChoices
>
> Choice {
>
> id: choice
>
> text: choiceText
>
> onButtonChecked: root.uncheckOthers(choice)
>
> }
>
> }
>
> }
>
> --
> Shady Zayat
>
>
> _______________________________________________
> Qt-qml mailing list
> Qt-qml at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-qml
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20100722/30ff0033/attachment.html
More information about the Qt-qml
mailing list