How to use nested if else block in QML



  • Hi,

    i am writing a javascript function in QML. In this function i want to use nested if else block as
    @if(statusText.text === "Active")
    {
    contextMenuModel.clear()
    contextMenuModel.append({"menuItem":"Block"})
    }
    if(statusText.text === "Terminated")
    {
    contextMenuModel.clear()
    contextMenuModel.append({"menuItem":"Allow"})
    }
    if(statusText.text === "Pending")
    {
    contextMenuModel.clear()
    contextMenuModel.append({"menuItem":"Allow"})
    contextMenuModel.append({"menuItem":"Block"})
    }@

    when i am displaying this model, using list view... in last codition it display only "Allow"..



  • Overall it should work unless you do something with worker threads. In that case you are missing model.sync().


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.