ComboBox text not getting changed.

  • Hello,
    I have a ComboBox, I want to change the Text in the ComboBox when the Button clicks. But when I click the button it shows an error "qrc:/main.qml:930: TypeError: Cannot assign to read-only property "currentText"" . Please support.

    The following code is used for the Button.

    Button {
    id: idNextButtonUser
    left: idPrevButtonUser.right
    topMargin: idRectangleInsideUserRegister.height/6
    leftMargin: idRectangleInsideUserRegister.width/8.5
    background: POS_FunctionButton {
    text: "Next"
    width: idRectangleInsideUserRegister.width/8
    height: idRectangleInsideUserRegister.height/3
    onClicked: {
    idTxtFieldUserName.text= _userMaster.UserName
    idComboBoxRole.currentText= _userMaster.Role

  • @danild
    QComboBox::currentText is a read-only property returning the current text. QComboBox::setEditText() is what you need to use to set the text, as per

Log in to reply