-
qml switch
Dear developers,
Can anyone tell me what is the signal handler for qml switch element because when I use "onclicked" or "onchecked "it is not a valid property.The only option valid is "onclipchange".In the qt doc,the valid signal is "clicked" but what handler should be use to use the signal as it is not mentioned in the doc.Also the "checked" property cannot be use.Is it a bug or something.My app target is symbian and I use latest qt creator version.Thank you.
[url]http://doc.qt.digia.com/qt-components-symbian-1.0/qml-switch.html[/url]
-
Re: qml switch
[QUOTE=chinster;911976]
[url]http://doc.qt.digia.com/qt-components-symbian-1.0/qml-switch.html[/url][/QUOTE]
From what I see the key to using the switch is in this line of code:
[QUOTE] text: switchComponent.checked ? "Switched on" : "Switched off"[/QUOTE]
The "switchComponent.checked ? " test will automatcially update when the switch is flicked.
You can add some more actions to that switch test, or alternatively within the text area also test for onTextChanged : {
-
Re: qml switch
[QUOTE=CLTSchwarz;912151]From what I see the key to using the switch is in this line of code:
The "switchComponent.checked ? " test will automatcially update when the switch is flicked.
You can add some more actions to that switch test, or alternatively within the text area also test for onTextChanged : {[/QUOTE]
Thank you for the alternative.Gonna try it tomorrow
-
Re: qml switch
Hi,
I had a similar issue using the Switch element (symbian components 1.1), it looks like this element not emit any signal (any onSomething).
My currently workaround is to use a [URL="http://doc.qt.digia.com/qt-components-symbian-1.0/qml-checkbox.html"]CheckBox[/URL].
-
Re: qml switch
I think it is a bug.Somehow qt creator didn't recognise it.I found some open source app that use switch element and open it with qt creator.Qt creator didn't recognize the "checked" property and the "oncheckchanged" signal handler,say it is not valid property but when compile,the app works find.Below is the code
[CODE]Switch {
52 id: fbSwitch
53
54 anchors {
55 left: fbImg.right
56 leftMargin: 10
57 verticalCenter: fbImg.verticalCenter
58 }
59 visible: facebook.authenticated
60 checked: true
61 }
62
63 Button {
64 id: fbButton
65
66 anchors {
67 left: fbImg.right
68 leftMargin: 10
69 verticalCenter: fbImg.verticalCenter
70 }
71
72 font {
73 family: "Impact"
74 pixelSize: platformStyle.fontSizeSmall[/CODE]
-
Re: qml switch
Found the solution.There is no need for signal handler to handle function.The "text :" property itself can be use to handle function.
[CODE]text: switchComponent.checked ? "switchon()" : "switchoff()"[/CODE]
Just need to put the switch function directly in the "text :" .Example "switchon()" is for opening the function while "switchoff()" to close the function.There are no signal handler for switch element.