[Solved] What is a valid signal for a Switch component?
-
I am trying to figure out how to use a signal of a QML Switch component (http://doc.qt.nokia.com/qt-components-symbian-1.0/qml-switch.html ).
According to above link (Qt components 1.0) it should work with the signal clicked, how ever I get this error:
Cannot assign to non-existent property "clicked"I had a look on /usr/lib/qt4/imports/com/nokia/meego/Switch.qml.
It defines the following signals:-
onClicked
-
onPositionChanged
-
onReleased
-
onCanceled
But none of them works either :(
Below is a example code.
The version with the CheckBox and Button work fine.@import QtQuick 1.0
import com.nokia.meego 1.0Column{
Switch{
// clicked: { console.log("Switch toggled") }
// onClicked: { console.log("Switch toggled") }
// onPositionChanged: { console.log("Switch toggled") }
// onReleased: { console.log("Switch toggled") }
// onCanceled: { console.log("Switch toggled") }
}CheckBox{
onClicked: { console.log("checkbox toggled") }
}Button{
text: "Button"
onClicked: { console.log("Button clicked") }
}}@
-
-
clicked is a signal, so you should have a signal handler namely onClicked, You cannot use it as a property.
@
Switch {
id: mySwitch
onClicked: console.debug("switch is clicked");
}
@ -
Yes, I tried on Symbian components. Since it is a non-platform specific property it should work on Meego.
-
Hmmm, that really surprises me :(
I tested it on my Linux PC as well as on My N950 (Harmattan).
I both OS I get this error:
Cannot assign to non-existent property "onClicked"In google I found this page which should be reference to the switch component for Harmattan:
http://library.developer.nokia.com/topic/MeeGo_1.2_Harmattan_API/html/qt-components/qt-components-meego-switch.html
How ever this page seems not to exist anymore. Here is a cached version from google:
http://webcache.googleusercontent.com/search?q=cache:iF5s0BE30BUJ:library.developer.nokia.com/topic/MeeGo_1.2_Harmattan_API/html/qt-components/qt-components-meego-switch.html+qml+switch&cd=3&hl=de&ct=clnk&client=ubuntuTo my surprise, there is no signal mentioned. :(
As a comparison, the checkbox has a signal clicked:
http://webcache.googleusercontent.com/search?q=cache:tP2Tj6DNmCgJ:library.developer.nokia.com/topic/MeeGo_1.2_Harmattan_API/html/qt-components/qt-components-meego-checkbox.html+qml+checkbox&cd=6&hl=de&ct=clnk&client=ubuntuSo I am wondering, why does it work on Symbian but not under Linux/Harmattan?
-
-
CaCO3,
Lol! Well, the auto-complet/code-assist thing's not perfect but helps a lot. The same for the integrated documentation, not perfect but helps.
The graphical thing's really badly useless/broken and using it's completely out of the question.
Except when you just want to see "what's possible".. like a quick documentation on styles, anchors.. properties.. etc.All in all, I'm enjoying Qt Creator a lot.. they are working hard on it and it's getting better and better everyday. :D
-
You are right, its a great tool and I am looking forward to see it working.
How ever as a Linux freak I often write smaller projects in a plain text editor and compile in the terminal. Linux has such good plain text editors and its so much faster.
Also, when you type the code by hand you also understand what you do :)But you are right, in the beginning i also used QtCreator to generate example code. Now I just forgot about that nice tool :)