QLCDnumber not Displaying as required !!
-
The diplay is only ".yyyy" or "dd.mm" ....all the six digits are not displayed . PLEASE review the given code ............
@#include<lcdtd.h>
#include<QtGui>lcdtd::lcdtd(QLCDNumber *parent):QLCDNumber(parent)
{
setWindowTitle("Time And Date");
QTimer *timer = new QTimer(this);
connect(timer,SIGNAL(timeout()),this,SLOT(showtime()));
timer->start(1000);resize(200,200);
}
void lcdtd::showtime()
{
QDate time = QDate::currentDate();
QString text= time.toString("dd.MM.yyyy");
this->display(text);
}
@ -
I might be wrong, but I would guess that your problem could be that QLCDNumber is designed for the display of numbers and the format you are passing in contains two decimal points?
What happens when you use colons or simple spaces as separators as opposed to full stops?
-
In your constructor add the following line:
@
setDigitCount(10);
@also your class should probably have a QWidget as parent.Something like this:
@lcdtd::lcdtd(QWidget *parent):QLCDNumber(parent)@By default the QLCDNumber does not have enough digits to hold your date.Hope this helps.
-
Look for the digital clock example in the documentation.It is very similar.