Results 1 to 4 of 4

Thread: QLCDNumber and desimal point

  1. #1
    Join Date
    Oct 2009
    Posts
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Question QLCDNumber and desimal point

    Hi,

    I am trying to make a countdown timer and got it working nicely using QTimer and QLCDNumber.
    Only challenges is that I would like to show minutes and seconds on the view. i will get it show them and counting down seconds , but when last decimal is 0 it will be hidden. Or even worst when both of them are 0 it just shows minutes

    Like this:
    - 9.50 will be 9.5
    - 9.00 will be 9

    How do I get it always show two decimals? and can I somehow change decimal point to be colon?

    Thanks
    -S
    Last edited by spylvas; 14th October 2009 at 08:27.

  2. #2
    Join Date
    Oct 2009
    Posts
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Smile Re: QLCDNumber and desimal point

    Hi,

    Solved it by using QTime.

    Qt Code:
    1. QString text = countDown.toString("mm:ss");
    2. ui->countDownLcdNumber->display(text);
    3. countDown = countDown.addSecs(-1);
    To copy to clipboard, switch view to plain text mode 
    Last edited by spylvas; 14th October 2009 at 09:38.

  3. The following user says thank you to spylvas for this useful post:

    V4Friend (13th August 2011)

  4. #3
    Join Date
    Apr 2010
    Posts
    11
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Lightbulb Re: QLCDNumber and desimal point

    OK, this helped me, though I wanted to display a 'float' with one decimal always. Displaying the LCDNumber using the text member-function lead me to this:

    Qt Code:
    1. ui.lcdNumX->display(QString("%1").arg(newdata.x, 0, 'f', 1));
    To copy to clipboard, switch view to plain text mode 

  5. #4
    Join Date
    Feb 2012
    Posts
    19
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QLCDNumber and desimal point

    hello

    i have a question I want to make the same countdown timer can you send me your project pls.
    I want to make a scoreboard whit a countdown timer.

    and than i can destract from your project

    thanks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.