[Interest] Can QML model specify a range including negative numbers? For example -180 to +180 ?

Daniel França daniel.franca at gmail.com
Wed Nov 4 16:02:57 CET 2015


If it's a sequential model you can:

1. Add the interval number as the model, and subtract the number you want.
model: 360

*Then:*
model -= 180

2. Create a javascript function to fill it:
function makeList(model){
     for (var x=-180; x <= 180; x++) {

        model.append({"value":x});

     }}


Em qua, 4 de nov de 2015 às 15:53, Edward Sutton <edward.sutton at subsite.com>
escreveu:

> Is there a way to declare a QML model range from -180 to +180?
>
> A method that does not require typing 361 numbers model: [-180, -179, … 0,
> … 179, 180 ] ?
>
>
>
> I added a Tumbler to Combining Qt Widgets and QML with
> QWidget::createWindowContainer()
> <http://www.ics.com/blog/combining-qt-widgets-and-qml-qwidgetcreatewindowcontainer>
> to experiment with making QML readable and writable from C++.
>
>
> Tumbler {
>
>     // latitude degrees -180 to +180
>
>     TumblerColumn {
>
>         model: 181  // <- Is there a way to declare model range -180 to +180 ?
>
>     }
>
>     // latitude minutes 0 - 59
>
>     TumblerColumn {
>
>         model: 60
>
>     }
>
>     // latitude seconds 0 - 59
>
>     TumblerColumn {
>
>         model: 60
>
>     }
>
> }
>
>
> Thanks in advance,
>
>
> -Ed
>
>
> This email and any files transmitted with it from The Charles Machine
> Works, Inc. are confidential and intended solely for the use of the
> individual or entity to which they are addressed. If you have received this
> email in error please notify the sender. Our company accepts no liability
> for the contents of this email, or for the consequences of any actions
> taken on the basis of the information provided, unless that information is
> subsequently confirmed in writing. Please note that any views or opinions
> presented in this email are solely those of the author and do not
> necessarily represent those of the company. Finally, the recipient should
> check this email and any attachments for the presence of viruses. The
> company accepts no liability for any damage caused by any virus transmitted
> by this email.
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20151104/c4c752e8/attachment.html>


More information about the Interest mailing list