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. qml formatting of number not working

qml formatting of number not working

Scheduled Pinned Locked Moved Solved QML and Qt Quick
2 Posts 1 Posters 253 Views
  • 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.
  • fcarneyF Offline
    fcarneyF Offline
    fcarney
    wrote on last edited by
    #1

    I have this code:

    console.log(typeof(powersupplyCurrent.dataValue))
    var num = powersupplyCurrent.dataValue.toLocaleString(Qt.locale, 'f', 2)
    console.log(num)
    

    The output:

    qml: number
    qml: 25.592187881469727
    

    The formatting is supposed to allow formatting of the output.

    I don't understand why it is not working.

    C++ is a perfectly valid school of magic.

    1 Reply Last reply
    0
    • fcarneyF Offline
      fcarneyF Offline
      fcarney
      wrote on last edited by
      #2

      Ah crap! I was missing parenthesis after Qt.locale. Should be Qt.locale().

      C++ is a perfectly valid school of magic.

      1 Reply Last reply
      1

      • Login

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