[Interest] Can QML model specify a range including negative numbers? For example -180 to +180 ?
André Somers
andre at familiesomers.nl
Fri Nov 6 10:53:58 CET 2015
Op 6-11-2015 om 10:10 schreef Curtis Mitch:
>
> You can use the columnForeground component [1] for this purpose:
>
> import QtQuick 2.3
>
> import QtQuick.Controls 1.2
>
> import QtQuick.Extras 1.2
>
> import QtQuick.Controls.Styles 1.2
>
> ApplicationWindow {
>
> visible: true
>
> width: 640
>
> height: 480
>
> title: qsTr("Hello World")
>
> Tumbler {
>
> id: tumbler
>
> anchors.centerIn: parent
>
> TumblerColumn {
>
> model: 90
>
> }
>
> TumblerColumn {
>
> model: 60
>
> }
>
> TumblerColumn {
>
> model: 60
>
> }
>
> TumblerColumn {
>
> model: ["N", "S"]
>
> }
>
I don't think I would keep the N/S (or E/W) option in a separate column.
Why not integrate that into the first column? You can easily use a
delegate to on the column to display negative values as S or W depending
on latitude or longitude. To stick to a standard notation, you would
have to put the N/S/E/W first in the column, like S 17|33|08.
Using a delegate can also solve your model problem the whole thread
started with. Just use a number again as the model, but only use the
positive range from 0 to 360. Then in your delegate simply adjust the
value from the model to the actual value you want to display.
André
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20151106/a43f566b/attachment.html>
More information about the Interest
mailing list