×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Apr 2008
    Posts
    105

    round double value to 2 demical place in qt quick

    I have a double value variable, i need to round it off to 2 decimal place.. how to do it in qt quick?

  2. #2
    Registered User
    Join Date
    Apr 2008
    Posts
    105

    Re: round double value to 2 demical place in qt quick

    woah.. nobody knows?

  3. #3
    Super Contributor
    Join Date
    Jul 2007
    Location
    Magnitogorsk, Russia
    Posts
    536

    Re: round double value to 2 demical place in qt quick

    Code:
    import QtQuick 1.0
    
    Rectangle {
        width: 360
        height: 360
        Text {
            id: txt
            anchors.centerIn: parent
            text: "Hello World"
        }
        MouseArea {
            anchors.fill: parent
            onClicked: {
                var value = 1.23456;
                txt.text = value.toFixed( 2 );
            }
        }
    }

Similar Threads

  1. Replies: 3
    Last Post: 2012-08-03, 16:37
  2. How to compile QML/QT Quick project in QT Creator?
    By useryy in forum [Archived] Qt SDKs and Tools
    Replies: 2
    Last Post: 2011-03-15, 05:49
  3. Replies: 1
    Last Post: 2011-03-06, 21:28
  4. Conversion from minus double value to String
    By archikong in forum Symbian
    Replies: 1
    Last Post: 2009-02-12, 22:59
  5. double value assign in TextField
    By mathi77in in forum Mobile Java General
    Replies: 0
    Last Post: 2005-07-04, 09:11

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×