Simplified example: Text { property var textForColor: {"transparent": "Waiting", "lime": "Ready", undefined: "Initializing"} text: textForColor[color] color: // set somewhere else, potentially undefined at the start }
But if I include the undefined key, QML complains. Fails execution with: Expected token `}' If the undefined key-pair is first, then QtCreator complains that the colon after "transparent" as: Expected token `,' If the undefined key-pair is last, then QtCreator complains that the colon after "transparent" as: Invalid property name "text" However in Node it works just fine (JS REPL): > var a = {undefined: "!", "1":"B"}; undefined > a { '1': 'B', undefined: '!' } > a[undefined] '!' > Object.keys(a) [ '1', 'undefined' ] Bug? Sure there are ways to work around this (change undefined to be a string, and when indexing color, make that a string too) but shouldn't this be able to support it as undefined itself? _______________________________________________ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest