Important: Please read the Qt Code of Conduct -

QLCDnumber not Displaying as required !!

  • The diplay is only ".yyyy" or "" ....all the six digits are not displayed . PLEASE review the given code ............

    lcdtd::lcdtd(QLCDNumber *parent):QLCDNumber(parent)
    setWindowTitle("Time And Date");
    QTimer *timer = new QTimer(this);



    void lcdtd::showtime()
    QDate time = QDate::currentDate();
    QString text= time.toString("dd.MM.yyyy");

  • 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?

  • See the documentation for the digitCount property. You need to set this large enough to hold all of your characters.

  • In your constructor add the following line:

    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.

Log in to reply