Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. QLCDnumber not Displaying as required !!

QLCDnumber not Displaying as required !!

Scheduled Pinned Locked Moved Qt Creator and other tools
5 Posts 4 Posters 2.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    rajatgupta431
    wrote on last edited by
    #1

    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);
    }
    @

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goblincoding
      wrote on last edited by
      #2

      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?

      http://www.goblincoding.com

      1 Reply Last reply
      0
      • N Offline
        N Offline
        N3Roaster
        wrote on last edited by
        #3

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

        1 Reply Last reply
        0
        • musimbateM Offline
          musimbateM Offline
          musimbate
          wrote on last edited by
          #4

          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.

          Why join the navy if you can be a pirate?-Steve Jobs

          1 Reply Last reply
          0
          • musimbateM Offline
            musimbateM Offline
            musimbate
            wrote on last edited by
            #5

            Look for the digital clock example in the documentation.It is very similar.

            Why join the navy if you can be a pirate?-Steve Jobs

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved