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. What parts of ECMAScript 7 are supported in Qt 5.12?
Forum Updated to NodeBB v4.3 + New Features

What parts of ECMAScript 7 are supported in Qt 5.12?

Scheduled Pinned Locked Moved Solved QML and Qt Quick
3 Posts 2 Posters 1.8k 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.
  • S Offline
    S Offline
    sirhcybe
    wrote on last edited by
    #1

    In the Qt 5.12 What's New documentation it states that:
    "The JavaScript engine now supports ECMAScript 7. This includes an upgrade to ECMAScript 6"
    However, it seems that there is only partial support for ECMAScript 7. Promises work (but are buggy) but arrow functions don't. Is there something I can reference other than this closed JIRA issue to give an official list of supported features? Or can someone tell me what's wrong with this code?

    import QtQuick 2.12
    import QtQuick.Window 2.12
    
    Window {
        visible: true
        width: 640
        height: 480
        title: qsTr("Hello World")
    
        Component.onCompleted: {
            const test = [1,2,3,4,5,6,7,8,9,];
            test.forEach(t => console.log(t));
        }
    }
    
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      For that kind of question you should go to the interest mailing list. You'll find there Qt's developers/maintainers. This forum is more user oriented.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • S Offline
        S Offline
        sirhcybe
        wrote on last edited by
        #3

        Thanks @SGaist. From this StackOverflow post I found that the problem was that the version of Qt Creator that ships with 5.12 doesn't support the new ECMAScript 7 syntax. I installed Qt Creator 4.9.0-beta2 and it's working.

        1 Reply Last reply
        4

        • Login

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