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
Forum Update on Monday, May 27th 2025

qml formatting of number not working

Scheduled Pinned Locked Moved Solved QML and Qt Quick
2 Posts 1 Posters 192 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.
  • F Offline
    F Offline
    fcarney
    wrote on 28 Aug 2020, 20:05 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
    • F Offline
      F Offline
      fcarney
      wrote on 28 Aug 2020, 20:07 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

      1/2

      28 Aug 2020, 20:05

      • Login

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