The Following 4 Users Say Thank You to olf For This Useful Post: | ||
![]() |
2018-03-13
, 21:36
|
Posts: 187 |
Thanked: 162 times |
Joined on May 2010
@ Sunny Woollahra
|
#12
|
The Following User Says Thank You to rfa For This Useful Post: | ||
![]() |
2018-03-13
, 22:26
|
|
Posts: 1,552 |
Thanked: 3,108 times |
Joined on Jun 2012
@ Russia, 96
|
#13
|
The Following 2 Users Say Thank You to Ancelad For This Useful Post: | ||
![]() |
2018-03-29
, 12:30
|
|
Posts: 433 |
Thanked: 727 times |
Joined on Oct 2012
@ Costa Blanca, Espaņa
|
#14
|
DetailItem { //% "WindDirection" label: qsTrId("Wind direction") value: { var windDirectionText var windDirection = 0 if (weather.windDirection=0) windDirectionText='N'; else if (weather.windDirection=45) windDirectionText='NE'; else if (weather.windDirection=90) windDirectionText='E'; else if (weather.windDirection=135) windDirectionText='SE'; else if (weather.windDirection=180) windDirectionText='S'; else if (weather.windDirection=225) windDirectionText='SW'; else if (weather.windDirection=270) windDirectionText='W'; else if (weather.windDirection=315) windDirectionText='NW'; } }
The Following 2 Users Say Thank You to Markkyboy For This Useful Post: | ||
![]() |
2018-03-29
, 18:41
|
Posts: 339 |
Thanked: 1,623 times |
Joined on Oct 2013
@ France
|
#15
|
The Following 2 Users Say Thank You to Zeta For This Useful Post: | ||
![]() |
2018-04-02
, 12:29
|
|
Posts: 433 |
Thanked: 727 times |
Joined on Oct 2012
@ Costa Blanca, Espaņa
|
#16
|
Shouldn't the test in the if be done using the comparison operator '==' (or '===' as QtCreator usually proposes when editing QML for a reason I forgot), and not the assignement operator '=' ?
And by the way, what do you do with the variable 'windDirectionText' ? I can't see it used anywhere except for setting its value ?
The Following 2 Users Say Thank You to Markkyboy For This Useful Post: | ||
![]() |
2018-04-02
, 16:03
|
Posts: 339 |
Thanked: 1,623 times |
Joined on Oct 2013
@ France
|
#17
|
I have used different variations with success, here's one example using a single '=' operator with success.
Problem is, my output text is stuck on "NE" and does not change when selecting different days, so clearly there is something wrong with my code, but I have no idea what, so any clues here would be appreciated.
DetailItem { //% "WindDirection" label: qsTrId("Wind direction") value: { if (weather.windDirection == 0) return 'N'; else if (weather.windDirection == 45) return 'NE'; else if (weather.windDirection == 90) return 'E'; else if (weather.windDirection == 135) return 'SE'; else if (weather.windDirection == 180) return 'S'; else if (weather.windDirection == 225) return 'SW'; else if (weather.windDirection == 270) return 'W'; else if (weather.windDirection == 315) return 'NW'; } }
The Following 3 Users Say Thank You to Zeta For This Useful Post: | ||
![]() |
2018-04-03
, 15:48
|
|
Posts: 433 |
Thanked: 727 times |
Joined on Oct 2012
@ Costa Blanca, Espaņa
|
#18
|
The Following 2 Users Say Thank You to Markkyboy For This Useful Post: | ||
![]() |
2018-04-04
, 22:39
|
Posts: 339 |
Thanked: 1,623 times |
Joined on Oct 2013
@ France
|
#19
|
import QtQuick 2.6 import QtQuick.Window 2.2 import QtQuick.Controls 1.4 import QtQuick.Layouts 1.3 Window { visible: true width: 640 height: 480 title: qsTr("Hello World") ColumnLayout { Slider { id : windDirection value: 180 minimumValue: 0 maximumValue: 315 stepSize: 45 } Text { text: { if (windDirection.value == 0) return 'N'; else if (windDirection.value == 45) return 'NE'; else if (windDirection.value == 90) return 'E'; else if (windDirection.value == 135) return 'SE'; else if (windDirection.value == 180) return 'S'; else if (windDirection.value == 225) return 'SW'; else if (windDirection.value == 270) return 'W'; else if (windDirection.value == 315) return 'NW'; } font.pixelSize: 36 color: "red" } Text { text: { if (windDirection.value == 0) 'N'; else if (windDirection.value == 45) 'NE'; else if (windDirection.value == 90) 'E'; else if (windDirection.value == 135) 'SE'; else if (windDirection.value == 180) 'S'; else if (windDirection.value == 225) 'SW'; else if (windDirection.value == 270) 'W'; else if (windDirection.value == 315) 'NW'; } font.pixelSize: 36 color: "green" } Text { text: (windDirection.value == 0) ? 'N' : (windDirection.value == 45) ? 'NE': (windDirection.value == 90) ? 'E': (windDirection.value == 135) ? 'SE': (windDirection.value == 180) ? 'S': (windDirection.value == 225) ? 'SW': (windDirection.value == 270) ? 'W': (windDirection.value == 315) ? 'NW' : '--' font.pixelSize: 36 color: "blue" } Text { text: ['N', 'NE', 'E', 'SE', 'S', 'SW', 'W', 'NW'][windDirection.value/45] font.pixelSize: 36 color: "#FF7F00" } } }
The Following 5 Users Say Thank You to Zeta For This Useful Post: | ||
![]() |
2018-04-10
, 15:29
|
|
Posts: 433 |
Thanked: 727 times |
Joined on Oct 2012
@ Costa Blanca, Espaņa
|
#20
|
DetailItem { id: windDirection //% "WindDirection" label: qsTrId("Wind direction") value: { if (model.windDirection==0) 'N' else if (model.windDirection==45) 'NE' else if (model.windDirection==90) 'E' else if (model.windDirection==135) 'SE' else if (model.windDirection==180) 'S' else if (model.windDirection==225) 'SW' else if (model.windDirection==270) 'W' else if (model.windDirection==315) 'NW' } }
The Following 3 Users Say Thank You to Markkyboy For This Useful Post: | ||
And I am absolutely with you.
But I already guessed that the answer is the obvious one: This is what many are accustomed to, i.e. what they perceive as usual (/ "normal") style.
But @rfa also provided a rationale, which I heard a couple of times from regular OL users reasoning for their email reply style, when using different clients than Outlook.
It is just an etiquette. Plus for "defenders of the right style", a convention.
I think a proper take away from @pichlo's injunction may be:
Do not top-post in Unix-centric environments.
Last edited by olf; 2018-03-13 at 20:18.