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. How to use nested if else block in QML
Forum Updated to NodeBB v4.3 + New Features

How to use nested if else block in QML

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 2 Posters 5.3k 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.
  • P Offline
    P Offline
    psbhardwaj09gmail.com
    wrote on last edited by
    #1

    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
    0
    • D Offline
      D Offline
      daliusd
      wrote on last edited by
      #2

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

      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