PDA

View Full Version : QLCDNumber and desimal point



spylvas
14th October 2009, 09:08
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

spylvas
14th October 2009, 10:06
Hi,

Solved it by using QTime.



QString text = countDown.toString("mm:ss");
ui->countDownLcdNumber->display(text);
countDown = countDown.addSecs(-1);

V4Friend
13th August 2011, 13:47
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:


ui.lcdNumX->display(QString("%1").arg(newdata.x, 0, 'f', 1));

arninio123
10th February 2012, 16:08
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