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. How can I use format for text?
Forum Updated to NodeBB v4.3 + New Features

How can I use format for text?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 3 Posters 256 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.
  • E Offline
    E Offline
    EmadDeve20
    wrote on last edited by
    #1

    I want to display only one decimal place in the text! How should I do this?

    jsulmJ 1 Reply Last reply
    0
    • E EmadDeve20

      I want to display only one decimal place in the text! How should I do this?

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @EmadDeve20 https://doc.qt.io/qt-5/qstring.html#arg-9

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      2
      • fcarneyF Offline
        fcarneyF Offline
        fcarney
        wrote on last edited by fcarney
        #3
        Text {
            property real somenumber: 12345.12345
            text: somenumber.toFixed(1)
        }
        

        This is a Javascript feature of Number.

        C++ is a perfectly valid school of magic.

        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