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. list of strings
Forum Updated to NodeBB v4.3 + New Features

list of strings

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 641 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.
  • Naveen_DN Offline
    Naveen_DN Offline
    Naveen_D
    wrote on last edited by
    #1

    Hi all
    how to create a list of strings in Qml ? like for example,
    list somename= {"good","better,"best"} and i want to compare it with other string, like if the given string is present in the list then display that string.
    Thanks

    Naveen_D

    YashpalY 1 Reply Last reply
    0
    • Naveen_DN Naveen_D

      Hi all
      how to create a list of strings in Qml ? like for example,
      list somename= {"good","better,"best"} and i want to compare it with other string, like if the given string is present in the list then display that string.
      Thanks

      YashpalY Offline
      YashpalY Offline
      Yashpal
      wrote on last edited by
      #2

      @Naveen_D said in list of strings:

      "good","better,"best"

          property var array: ["good","better","best"]
      
      
          Text {
              id: name
              anchors.centerIn: parent
              text: ""
              color: "black"
          }
      
          Component.onCompleted: {
              var i = 0;
              console.log("Length +++++++ " + array.length)
              while(array.length > i)
              {
                  if(array[i] === "best")
                  {
                      console.log("Found +++++++ " + array[i])
                      name.text = array[i]
                      break;
                  }
                  i++;
              }
          }
      

      Hope, you are looking for something like this.

      My suggestion is to keep more of business logic in C++ module and then expose them to QML UI.

      1 Reply Last reply
      3

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved