[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 10:10:48 CET 2015


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"]
        }

        property var columnTitles: ["Degrees", "Minutes", "Seconds", "North/South"]

        style: TumblerStyle {
            columnForeground: Item {
                Text {
                    text: tumbler.columnTitles[styleData.column]
                    anchors.horizontalCenter: parent.horizontalCenter
                    anchors.bottom: parent.top
                    anchors.bottomMargin: height
                }
            }
        }
    }
}

Note that there is a limitation [2] that affects your current usage of Tumbler:

"For technical reasons, the model count must be equal to or greater than visibleItemCount plus one."

You might want to consider using a Switch for the North/South option.

By the way, is this UI for a touch device?

[1] http://doc.qt.io/qt-5/qml-qtquick-controls-styles-tumblerstyle.html#columnForeground-prop
[2]  http://doc.qt.io/qt-5/qml-qtquick-extras-tumbler.html#limitations

From: Interest [mailto:interest-bounces at qt-project.org] On Behalf Of Edward Sutton
Sent: Thursday, 5 November 2015 4:25 PM
To: André Somers <andre at familiesomers.nl>
Cc: interest at qt-project.org
Subject: Re: [Interest] Can QML model specify a range including negative numbers? For example -180 to +180 ?

Never mind, the answer is TumblerStyle<http://doc.qt.io/qt-5/qml-qtquick-controls-styles-tumblerstyle.html>.

http://doc.qt.io/qt-5/qtquick-controls-styles-qmlmodule.html

Is it possible to add column headers to a Qt 5.5  TumblerColumn<http://doc.qt.io/qt-5/qml-qtquick-extras-tumblercolumn.html>?

Degrees  Minutes Seconds

I need to learn how to compose a QML UI consisting of multiple components, text and other wise.

-Ed

[cid:image001.png at 01D1187B.59C4F8A0]


On Nov 5, 2015, at 9:14 AM, Edward Sutton <edward.sutton at subsite.com<mailto:edward.sutton at subsite.com>> wrote:


On Nov 5, 2015, at 8:34 AM, André Somers <andre at familiesomers.nl<mailto:andre at familiesomers.nl>> wrote:

Op 4-11-2015 om 18:27 schreef Edward Sutton:

<Mail Attachment.png>



I would set the number of items visible on the spinner columns to something higher than 3 for this application though. 5 or 7 would look nicer I think.


Good advice!  How do you configure number of items visible?

I am using Qt 5.5 commercial.  I cannot find a property that sounds like it controls the number of visible items on the wheel?

http://doc.qt.io/qt-5/qml-qtquick-extras-tumbler.html
http://doc.qt.io/qt-5/qml-qtquick-extras-tumblercolumn.html
Properties
·         activeFocus<http://doc.qt.io/qt-5/qml-qtquick-extras-tumblercolumn.html#activeFocus-prop> : bool
·         columnForeground<http://doc.qt.io/qt-5/qml-qtquick-extras-tumblercolumn.html#columnForeground-prop> : Component
·         currentIndex<http://doc.qt.io/qt-5/qml-qtquick-extras-tumblercolumn.html#currentIndex-prop> : int
·         delegate<http://doc.qt.io/qt-5/qml-qtquick-extras-tumblercolumn.html#delegate-prop> : Component
·         highlight<http://doc.qt.io/qt-5/qml-qtquick-extras-tumblercolumn.html#highlight-prop> : Component
·         model<http://doc.qt.io/qt-5/qml-qtquick-extras-tumblercolumn.html#model-prop> : var
·         role<http://doc.qt.io/qt-5/qml-qtquick-extras-tumblercolumn.html#role-prop> : string
·         visible<http://doc.qt.io/qt-5/qml-qtquick-extras-tumblercolumn.html#visible-prop> : bool
·         width<http://doc.qt.io/qt-5/qml-qtquick-extras-tumblercolumn.html#width-prop> : real
With QML in general, I do not understand how you learn what QML component signals and properties are available on a component and what is configurable and what is not.

QML seems similar to Qt3D - you must read a lot of examples and do a lot of trial and error experimenting.  I must be missing something?

-Ed




André
_______________________________________________
Interest mailing list
Interest at qt-project.org<mailto:Interest at qt-project.org>
http://lists.qt-project.org/mailman/listinfo/interest

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<mailto:Interest at qt-project.org>
http://lists.qt-project.org/mailman/listinfo/interest

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20151106/c81f92c3/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 53564 bytes
Desc: image001.png
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20151106/c81f92c3/attachment.png>


More information about the Interest mailing list