How to use a Checkable Element?



  • "http://doc.qt.nokia.com/qtquick-components-symbian-1.1/qml-checkable.html":http://doc.qt.nokia.com/qtquick-components-symbian-1.1/qml-checkable.html
    I try to use above Checkable Element to make my own component.
    However, my code never works. Here is my code:
    @import QtQuick 1.1
    import com.nokia.symbian 1.1
    import Qt.labs.components 1.1

    Page {
    id: mainPage
    CheckableGroup {
    id: checkableGroup
    Checkable {
    id: brotherCheckable
    default property string text: "brother"
    exclusiveGroup: checkableGroup
    onCheckedChanged: console.log("seletedValue is " + checkableGroup.selectedValue)
    }
    Checkable {
    id: sisterCheckable
    default property string text: "sister"
    exclusiveGroup: checkableGroup

        }
    }
    

    }@

    I just get the error code like this
    @Cannot assign to non-existent default property
    Checkable {
    ^ @

    Anyone know what I should do now?

    Thank you.


  • Moderators

    Try it without the "default" keyword in the Checkables.



  • Still the same. =.=||
    [quote author="mlong" date="1335368056"]Try it without the "default" keyword in the Checkables.

    [/quote]



  • Hi,

    I think you can't define new property where you use component. You have to put your Checkable element in separate QML file in order to create new component or in Component { } block.



  • I haven't found a way to use it. I am now downloading the source code to see how the radioButton write. Any workable codes are appreciated too.
    [quote author="task_struct" date="1335427068"]Hi,

    I think you can't define new property where you use component. You have to put your Checkable element in separate QML file in order to create new component or in Component { } block.[/quote]


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.