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. Customised RadioButton not working
Forum Updated to NodeBB v4.3 + New Features

Customised RadioButton not working

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 409 Views
  • 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.
  • B Offline
    B Offline
    basha92
    wrote on last edited by
    #1

    Hi All,

    I am working with QtQuick 1.1

    I have a Radio as follows

    CRadio.qml

    import QtQuick 1.1
    
    Rectangle {
        id: sideButton
        property RadioGroup radioGroup
        property string text: 'Button'
        radius:20
        border.color: "black"
        border.width: 2
        property bool checked: false
    
        color:  radioGroup.selected === sideButton ? '#4FB549' :
                                                     (sideButtonMouseArea.containsMouse ? '#DDDDDD' : '#F4F4F4')
    
        onCheckedChanged:
        {
            console.log("onCheckedChanged");
            sideButton.radioGroup.selected === sideButton
        }
        MouseArea {
            id: sideButtonMouseArea
            anchors.fill: parent
            hoverEnabled: true
            onClicked: sideButton.radioGroup.selected = sideButton
    
        }
    }
    

    and

    RadioGroup.qml

    import QtQuick 1.1
    
    QtObject {
        id:root
        property Item selected : null
    }
    

    and in main.qml when i am calling

     RadioGroup {
            id: radioGroup1
        }
    
        CRadio
        {
            x:100
            y:220
            width:25
            checked:true
            radioGroup: radioGroup1
            height: 25
    
        }
    

    When UI is loaded i can click on the MouseArea, It is working fine on Loading.
    I am getting following error.
    qrc:/CRadio.qml:18: TypeError: Result of expression 'sideButton.radioGroup' [null] is not an object.

    What would will be problem ?

    Thanks in Advance.
    Regards,
    Basha.

    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