Why QLCDNumber numbers can't be centered when the number of digits is lower than the number of digits allowed in the parameters of QLCDNumber ? Can I bypass this ?
Asked
Active
Viewed 1,680 times
1 Answers
2
As a workaround you can set the number of digits each time you set a new value :
ui->lcdNumber->display(value);
ui->lcdNumber->setDigitCount(QString("%1").arg(value).length());
Here QString("%1").arg(value).length()
returns the number of digits in value
. When you set it properly it would be aligned correctly.

Nejat
- 31,784
- 12
- 106
- 138
-
"`value/10+1` returns the number of digits in `value`" - really? There are 10 digits in the value `99`? – Toby Speight Jul 03 '15 at 14:08
-
@TobySpeight That was a bad mistake. You are right, it's corrected now. – Nejat Jul 03 '15 at 15:02