Problem with CheckBox
-
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 errorInvalid 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 -
I test your following code with Qt 6.10 on Ubuntu 22.04 and did not see any issue.
run the command
qml filename.qmlimport 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 } } }