Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    How to use nested if else block in QML

    QML and Qt Quick
    2
    2
    4880
    Loading More Posts
    • 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.
    • P
      psbhardwaj09gmail.com last edited by

      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"..

      Pardeep Sharma

      1 Reply Last reply Reply Quote 0
      • D
        daliusd last edited by

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

        1 Reply Last reply Reply Quote 0
        • First post
          Last post