Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to use a Checkable Element?
Forum Updated to NodeBB v4.3 + New Features

How to use a Checkable Element?

Scheduled Pinned Locked Moved QML and Qt Quick
5 Posts 3 Posters 2.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    owenzhao
    wrote on last edited by
    #1

    "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.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mlong
      wrote on last edited by
      #2

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

      Software Engineer
      My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

      1 Reply Last reply
      0
      • O Offline
        O Offline
        owenzhao
        wrote on last edited by
        #3

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

        [/quote]

        1 Reply Last reply
        0
        • T Offline
          T Offline
          task_struct
          wrote on last edited by
          #4

          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.

          "Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program."

          • Linu...
          1 Reply Last reply
          0
          • O Offline
            O Offline
            owenzhao
            wrote on last edited by
            #5

            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]

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved