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. Problem with CheckBox
Qt 6.11 is out! See what's new in the release blog

Problem with CheckBox

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 3 Posters 342 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.
  • msauer751M Offline
    msauer751M Offline
    msauer751
    wrote on last edited by
    #1

    Hi,
    after I have problems with QML checkboxes in Android I do some test on my linux. I added a checkbox on the startscreen of my app and I get the error

    Invalid property name "text" (M16)
    

    I copied the code from the QML help example

    import QtQuick
    import QtQuick.Controls
    import assets 1.0
    import components 1.0
    
    Item {
        Rectangle {
            anchors.fill: parent
    
            Image {
                width: parent.width
                height: parent.height
                source: Style.imageBackground
            }
    
            //HeaderBox {
            //    headerText: "Willkommen zur Schafkopfverwaltung"
            //}
    
            Column {
                id: scrollView
                anchors {
                    left: parent.left
                    right: parent.right
                    top: parent.top
                    bottom: parent.top
                    margins: Style.sizeScreenMargin
                }
                clip: true
    
    
            }
            Text {
                text: "Hello World!"
                font.family: "Helvetica"
                font.pointSize: 24
                color: "red"
            }
            CheckBox {
                id: parentBox
                text: qsTr("Parent")
                checkState: childGroup.checkState
            }
    
    
            ErrorMessageBox {
                headerText: masterController.uiErrCtrl.uiMsg
                visibleBox: masterController.uiErrCtrl.uiAct
            }
    
            OkMessageBox {
                id: okBox
                headerText: masterController.uiOkCtrl.uiMsg
                visibleBox: masterController.uiOkCtrl.uiAct
            }
        }
    }
    

    If I start the app I will get the message:

    qrc:/views/MasterView.qml:51:5: QML StackView: replace: qrc:/views/DashboardView.qml:42 Cannot assign to non-existent property "checkState"
    

    I don't know where the problem is.
    Can you help me to solve it.
    Thank you
    BR
    Martin

    1 Reply Last reply
    0
    • B Offline
      B Offline
      Bandler
      wrote on last edited by
      #2
      This post is deleted!
      1 Reply Last reply
      0
      • JoeCFDJ Offline
        JoeCFDJ Offline
        JoeCFD
        wrote on last edited by JoeCFD
        #3

        I test your following code with Qt 6.10 on Ubuntu 22.04 and did not see any issue.

        run the command
        qml filename.qml

        import QtQuick
        import QtQuick.Controls
        
        Item {
            Rectangle {
                anchors.fill: parent
        
                Image {
                    width: parent.width
                    height: parent.height
                    //source: Style.imageBackground
                }
        
                //HeaderBox {
                //    headerText: "Willkommen zur Schafkopfverwaltung"
                //}
        
                Column {
                    id: scrollView
                    anchors {
                        left: parent.left
                        right: parent.right
                        top: parent.top
                        bottom: parent.top
                        //margins: Style.sizeScreenMargin
                    }
                    clip: true
        
        
                }
                Text {
                    text: "Hello World!"
                    font.family: "Helvetica"
                    font.pointSize: 24
                    color: "red"
                }
                CheckBox {
                    id: parentBox
                    text: qsTr("Parent")
                    checkState: Qt.Checked//childGroup.checkState
                }
            }
        }
        
        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