[Interest] Can QML model specify a range including negative numbers? For example -180 to +180 ?
Edward Sutton
edward.sutton at subsite.com
Fri Nov 6 14:52:14 CET 2015
On Nov 6, 2015, at 3:53 AM, André Somers <andre at familiesomers.nl<mailto:andre at familiesomers.nl>> wrote:
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?
Can you please elaborate? Do you mean create a model with 180 items ranging from "N 0" to "N 90” and "S 0" to "S 90”?
Or 180 numbers and the delegate adds a “N” or “S” and subtracts 90 when needed?
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.
So a QML delegate can transform magic model numbers into real-world user display data? For example a number 0 into “Apple”?
I am not sure I understand what delegates are operating on. In the case of a TumblerColumn it would be the current index?
http://doc.qt.io/qt-5/qml-qtqml-models-delegatemodel.html
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20151106/217e4721/attachment.html>
More information about the Interest
mailing list