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

Curtis Mitch mitch.curtis at theqtcompany.com
Fri Nov 6 11:00:44 CET 2015



From: Interest [mailto:interest-bounces at qt-project.org] On Behalf Of André Somers
Sent: Friday, 6 November 2015 10:54 AM
To: interest at qt-project.org
Subject: Re: [Interest] Can QML model specify a range including negative numbers? For example -180 to +180 ?

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.
I'm just showing Edward how he can add headers to the Tumbler by extending the UI he already had. As I said, there are issues having only two items in the model anyway, and a Switch would probably be better for such a small amount of options, depending on the context.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20151106/7da1a468/attachment.html>


More information about the Interest mailing list