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. variable length qml
Qt 6.11 is out! See what's new in the release blog

variable length qml

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

    Hi,
    I have a small question, like to know if someone can help me:
    I leave here an example of what I intend to:

      var value
      value = 7/3600
     console.log(value)
    

    And the result is: 0,0019444444444444, but I just want to see: 0,0019
    is there any way to limit the number of digits of the variable?

    Thanks a lot.

    1 Reply Last reply
    0
    • I Offline
      I Offline
      Iktwo
      wrote on last edited by
      #2

      Call .toFixed(NUMBER) on the value that you want with the number of decimals that you need

      1 Reply Last reply
      0
      • J Offline
        J Offline
        joanaguimas
        wrote on last edited by
        #3

        Thank you! It works!

        1 Reply Last reply
        0

        • Login

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