I am trying to create a map in QML, the only way I've found to do this is:
readonly property variant translate: { "Hello" : "123" }
Then in the QML I can get 123 by using:
idOfItem.translate["Hello"]
This works fine and when doing this I get "123" returned as desired. Now what I want to do is define another property to replace "Hello" which can be used in the QML, ideally something like:
readonly property string strHello: "Hello"
readonly property variant translate: { strHello : "123" }
Then in the QML:
idOfItem.translate[idOfItem.strHello]
This doesn't work and when trying to put strHello into the initial definition a read underscore appears under ":".
Can this be resolved?